Accounts

The accounts resource in the OpenTrnasact API is an important feature for managing payment transactions. This resource allows for the creation and management of different account types, which can include payment account identifiers and credentials. The OpenTransact API securely stores sensitive information associated with these accounts, ensuring that transactions can be processed in a safe and secure manner. This resource allows for flexibility in managing different types of payment accounts, making it easier for applications to process transactions and manage financial information.

Data Types

AccountResponse

KeyValue
typeaccounts
idUUID
Attributes
nicknameString
statusnew, active, or invalid
detailsBankAccount, CreditCard, VaultedAccount, or ChinaBankAccount
metadataMetadata
created-atTimestamp
updated-atTimestamp
Relationships
ownerOwnerRelationship

Example

{
  "data": {
    "id": "4c72784e-fb2a-4858-8067-95b6e36d54c0",
    "type": "accounts",
    "attributes": {
      "nickname": "Chase Account",
      "status": "active",
      "details": {
        "type": "bank-accounts",
        "routing-number": "021000021",
        "account-holder-type": "business",
        "account-category": "checking"
      },
      "metadata": {},
      "created-at": "2022-06-21T23:34:04Z",
      "updated-at": "2022-06-21T23:34:04Z"
    },
    "relationships": {
      "owner": {
        "data": {
          "type": "profiles",
          "id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
        }
      }
    }
  }

CreateAccountRequest

KeyValue
typeaccounts
Required
Attributes
nicknameString
Required
detailsBankAccountParams, CreditCardParams, VaultedAccountParams, or ChinaBankAccountParams
Required
Relationships
ownerOwnerRelationship
Required

Example

{ 
  "data": {
    "type": "accounts",
    "attributes": {
      "nickname": "Chase Account",
      "details": {
        "type": "bank-accounts",
        "account-number": "4111111111111111",
        "routing-number": "021000021",
        "account-holder-type": "business",
        "account-category": "checking"
      }
    },
    "relationships": {
      "owner": {
        "data": {
          "type": "profiles",
          "id": "$PROFILE_ID" 
        }
      }
    }
  }
}

UpdateAccountRequest

KeyValueRequired
typeaccounts
Required
idUUID
Required
Attributes
nicknameString
detailsUpdateCreditCardParams
metadataMetadata

Example

{
  "data": {
    "id": "4c72784e-fb2a-4858-8067-95b6e36d54c0",
    "type": "accounts",
    "attributes": {
      "nickname": "Chase Account",
      "details": {
        "type": "bank-accounts",
        "account-number": "4111111111111111",
        "routing-number": "021000021",
        "account-holder-type": "business",
        "account-category": "checking"
      }
    }
  }
}

BankAccountParams

KeyValue
typebank-accounts
Required
routing-numberString
Required
account-numberString
Required
account-holder-typepersonal or business
Required
account-categorychecking or savings
Required

BankAccountParams Example

{
  "type": "bank-accounts",
  "routing-number": "021000021",
  "account-number": "4111111111111111",
  "account-holder-type": "business",
  "account-category": "checking"
}

BankAccount

KeyValue
typebank-accounts
routing-numberString
account-holder-typepersonal or business
account-categorychecking or savings

BankAccount Example

{
  "type": "bank-accounts",
  "routing-number": "021000021",
  "account-holder-type": "business",
  "account-category": "checking"
}

ChinaBankAccountParams

KeyValue
typechina-bank-accounts
Required
accountString
Required
bankString
bank-branchString

ChinaBankAccountParams Example

{
  "type": "china-bank-accounts",
  "account": "6227000048088888",
  "bank-branch": "123456"
}

ChinaBankAccount

KeyValue
typechina-bank-accounts
descriptionString
bankString
bank-branchString

ChinaBankAccount Example

{
  "type": "china-bank-accounts",
  "description": "My China Bank Account",
  "bank": "Bank of China",
  "bank-branch": "123456"
}

CreditCardParams

KeyValueRequiredNotes
typecredit-cards
Required
card-numberString
Required
cardholder-nameString
Required
billing-address-idUUID
Required
expiration-dateString
Required
MMYY format
cvvString

CreditCardParams Example

{
  "type": "credit-cards",
  "card-number": "4111111111111111",
  "cardholder-name": "John Smith",
  "billing-address-id": "e7765383-cb90-4494-8ea0-79564b1b857a",
  "expiration-date": "0126",
  "cvv": "997"
}

UpdateCreditCardParams

KeyValue
typecredit-cards
Required
cardholder-nameString
billing-address-idUUID
cvvString

UpdateCreditCardParams Example

{
  "type": "credit-cards",
  "cardholder-name": "John Wayne",
  "cvv": "997"
}

CreditCard

KeyValueNotes
typecredit-cards
binStringFirst 8 digits of Card Number used to identify the Bank/Issuer
bin-detailsBinDetailsAdditional details about the BIN (requires subscription)
billing-addressBillingAddress
brandCardBrandCard Brand Identifier
card-holder-nameString
expiration-dateString
last-fourStringLast 4 digits of the card number

CreditCard Example

{
  "type": "credit-cards",
  "bin": "55555555",
  "bin-details": {},
  "billing-address": {
    "id": "e7765383-cb90-4494-8ea0-79564b1b857a",
    "street1": "111 PEACHTREE PLACE",
    "street2": null,
    "zipcode": "30345",
    "locality": "Atlanta",
    "sub-locality": null,
    "region": "GA",
    "country": "US",
  },
  "brand": "master",
  "card-holder-name": "John Smith",
  "expiration-date": "0126",
  "last-four": "4444"
}

BinDetails

Value
TBD

CardBrand

Value
visa
master
discover
american_express
diners_club
jcb
dankort
maestro
forbrugsforeningen
elo
alelo
cabal
naranja
union_pay
alia
olimpica
creditel

BillingAddress

KeyValue
idUUID
street1String
street2String
zipcodeString
localityString
sub-localityString
regionString
countryString

BillingAddress Example

{
  "id": "e7765383-cb90-4494-8ea0-79564b1b857a",
  "street1": "111 PEACHTREE PLACE",
  "street2": null,
  "zipcode": "30345",
  "locality": "Atlanta",
  "sub-locality": null,
  "region": "GA",
  "country": "US"
}

VaultedAccountParams

KeyValue
typevaulted-accounts
Required
vault-providerString
Required
vault-identifierString
Required
account-infoObject

VaultedAccountParams Example

{
  "type": "vaulted-accounts",
  "vault-provider": "stripe",
  "vault-identifier": "tok_1234567890"
}

VaultedAccount

KeyValue
typevaulted-accounts
vault-providerString
vault-identifierString
account-infoObject

VaultedAccount Example

{
  "type": "vaulted-accounts",
  "vault-provider": "stripe",
  "vault-identifier": "tok_1234567890",
  "account-info": {
    "stripe-customer-id": "cus_1234567890"
  }
}

GET/v1/accounts

List Accounts

This endpoint retreives a paginated list of Accounts. By default, a maximum of thirty Accounts are shown per page.

This endpoint returns an array of AccountResponse objects.

Filters

  • Name
    owner_id
    Type
    string
    Description

    The ID of the Owner that owns the Account.

  • Name
    owner_type
    Type
    string
    Description

    The type of the Owner that owns the Account.

  • Name
    status
    Type
    string
    Description

    The status of the Account.

  • Name
    created_between
    Type
    object
    Description
    See documentation for filtering by timestamps.
  • Name
    updated_between
    Type
    object
    Description
    See documentation for filtering by timestamps.
  • Name
    metadata
    Type
    object
    Description
    See documentation for filtering by metadata.
  • Name
    page
    Type
    object
    Description
    See documentation for pagination.

Request

GET
/v1/accounts
curl -G https://api.opentransact.com/v1/accounts \
  -H "Authorization: Bearer {token}" \
  -H 'Content-Type: application/vnd.api+json'

Response

{
"data": [{
  "id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
  "type": "accounts",
  "attributes": {
    "nickname": "Chase Account",
    "details": {
      "type": "bank-accounts",
      "routing-number": "021000021",
      "account-holder-type": "business",
      "account-category": "checking"
    },
    "status": "new",
    "metadata": {},
    "created-at": "2022-06-21T23:34:04Z",
    "updated-at": "2022-06-21T23:34:04Z"
  },
  "relationships": {
    "owner": {
      "data": {
        "type": "profiles",
        "id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
      }
    }
  }
},
{
  id: ...,
},
"meta": {
  "count": 38,
  "page-count": 2,
  "current-page": 1
},
"links": {
  "self": "https://api.opentransact.com/v1/accounts?page%5Bnumber%5D=1&page%5Bsize%5D=30",
  "first": "https://api.opentransact.com/v1/accounts?page%5Bnumber%5D=1&page%5Bsize%5D=30",
  "last": "https://api.opentransact.com/v1/accounts?page%5Bnumber%5D=2&page%5Bsize%5D=30",
  "next": "https://api.opentransact.com/v1/accounts?page%5Bnumber%5D=2&page%5Bsize%5D=30"
}
}

POST/v1/accounts

Create an Account

This endpoint creates a new Account.

This endpoint accepts a CreateAccountRequest object and returns an AccountResponse object.

Request

POST
/v1/accounts
curl https://api.opentransact.com/v1/accounts \
  -H "Authorization: Bearer {token}" \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
        "data": {
          "type": "accounts",
          "attributes": {
            "nickname": "Chase Account",
            "details": {
              "type": "bank-accounts",
              "account-number": "4111111111111111",
              "routing-number": "021000021",
              "account-holder-type": "business",
              "account-category": "checking"
            }
          },
          "relationships": {
            "owner": {
              "data": {
                "type": "profiles",
                "id": "$PROFILE_ID"
              }
            }
          }
        }
      }'

Response

{
  "data": {
    "id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
    "type": "accounts",
    "attributes": {
      "nickname": "Chase Account",
      "details": {
        "type": "bank-accounts",
        "routing-number": "021000021",
        "account-holder-type": "business",
        "account-category": "checking"
      },
      "status": "new",
      "metadata": {},
      "created-at": "2022-06-21T23:34:04Z",
      "updated-at": "2022-06-21T23:34:04Z"
    },
    "relationships": {
      "owner": {
        "data": {
          "type": "profiles",
          "id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
        }
      }
    }
  }
}

GET/v1/accounts/:id

Show an Account

This endpoint retrieves an Account by providing its ID.

This endpoint returns an AccountResponse object.

Request

GET
/v1/accounts/4c72784e-fb2a-4858-8067-95b6e36d54c0
curl https://api.opentransact.com/v1/accounts/4c72784e-fb2a-4858-8067-95b6e36d54c0 \
  -H "Authorization: Bearer {token}"

Response

{
  "data": {
    "id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
    "type": "accounts",
    "attributes": {
      "nickname": "Chase Account",
      "details": {
        "type": "bank-accounts",
        "routing-number": "021000021",
        "account-holder-type": "business",
        "account-category": "checking"
      }
    },
    "relationships": {
      "owner": {
        "data": {
          "type": "profiles",
          "id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
        }
      }
    }
  }
}

PUT/v1/accounts/:id

Update an Account

This endpoint performs an update on an Account.

This endpoint accepts an UpdateAccountRequest object and returns an AccountResponse object.

Request

PUT
/v1/accounts/4c72784e-fb2a-4858-8067-95b6e36d54c0
curl -X PUT https://api.opentransact.com/v1/accounts/4c72784e-fb2a-4858-8067-95b6e36d54c0 \
  -H "Authorization: Bearer {token}" \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
        "data": {
          "id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
          "type": "accounts",
          "nickname": "VISA Card Updated",
          "details": {
            "type": "credit-cards",
            "cardholder-name": "John Wayne",
            "cvv": "997"
          }
        }
      }'

Response

{
  "data": {
    "id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
    "type": "accounts",
    "attributes": {
      "nickname": "VISA Card",
      "details": {
        "bin": "55555555",
        "bin-details": {},
        "last-four": "4444",
        "brand": "master",
        "cardholder-name": "John Smith",
        "expiration-date": "0126",
        "billing-address": {
          "street1": "111 PEACHTREE PLACE",
          "street2": null,
          "zipcode": "30345",
          "locality": "Atlanta",
          "sub-locality": null,
          "region": "GA",
          "country": "US",
          "created-at": "2022-06-21T23:22:08Z",
          "updated-at": "2022-06-21T23:22:08Z",
          "id": "e7765383-cb90-4494-8ea0-79564b1b857a"
        },
        "type": "credit-cards"
      },
      "status": "new",
      "metadata": {},
      "created-at": "2022-06-21T23:34:04Z",
      "updated-at": "2022-06-21T23:34:04Z"
    },
    "relationships": {
      "owner": {
        "data": {
          "type": "profiles",
          "id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
        }
      }
    }
  }
}

Was this page helpful?