Tokenize bank accounts
Turn a customer's bank account into a token, from PaymentElements in the browser or from your server.
A bank account token stands in for a customer's account and routing numbers, so you can charge the account without sending or storing those numbers. You get a bank account token in one of two ways:
- From the browser: PaymentElements collects the account on your checkout page and returns a single-use token.
- From your server: you send account details that your systems already hold, and Preczn returns a multi-use token.
A multi-use bank account token doesn't expire. A single-use token expires after 24 hours. See Key concepts.
You tokenize a bank account through PaymentElements or the API.
Prerequisites
- A merchant whose connection accepts ACH. See the ACH column in Supported connections.
- For the browser: a public API key. For your server: a private API key. See API keys.
Collect a bank account in the browser
PaymentElements renders the account number, routing number, account type, and bank country fields in Preczn-hosted frames, then returns a single-use token. For the steps, see Collect payment details with PaymentElements.
The account type picker shows its own values. PaymentElements maps each one to the API account type before it tokenizes the account:
| PaymentElements value | API account type |
|---|---|
checking | personalChecking |
savings | personalSavings |
businessChecking | corporateChecking |
businessSavings | corporateSavings |
The bank country picker offers US, which PaymentElements sends as USA.
To keep the account for later charges, exchange the single-use token for a multi-use token. Send a verify or a sale with the single-use token in payment.token and the ?tokenize=true query parameter. See Verify a bank account.
Tokenize a bank account from your server
Unlike credit card data (which falls under PCI scope), many businesses already store bank account information, making this a common integration path.
Choose how you send the account details:
- Without a transaction: create the token directly, for example when a customer saves a bank account in their profile.
- With a transaction: create the token while you verify or charge the account.
Create a token without a transaction
-
Send
POST /v1/tokenswith your private API key. SettypetobankAccount, put the account inbankAccount, and setmerchantIdto the merchant that charges the account.{ "type": "bankAccount", "merchantId": "{merchantId}", "bankAccount": { "type": "personalChecking", "account": "123456789", "routing": "987654321", "bankCountry": "USA" }, "firstName": "{firstName}", "lastName": "{lastName}" }{ "token": "tkn_test_{tokenId}", "type": "bankAccount", "merchantId": "{merchantId}", "bankAccount": { "type": "personalChecking", "bankCountry": "USA" } }This response is abbreviated. The sample account and routing numbers are the approved test bank account from Test data.
-
Store the
tokenvalue with the customer's record, and discard the account and routing numbers.
Create a token with a transaction
- Send
POST /v1/transactionswith the account inpayment.bankAccountand the?tokenize=truequery parameter. For the request, see Verify a bank account or Charge a bank account. - Read the multi-use token from
payment.tokenin the response. Preczn returns it when the transaction is approved or pending.
Account holder details
Send the account holder's details with the account, either when you create the token or on the transaction. Preczn stores them on the token, and later transactions with the token use them. For which names a personal or corporate account needs, see ACH payments.
| Field | What it holds |
|---|---|
firstName, lastName | The account holder's name |
accountBusinessName | The business name on a corporate account |
achMandate | The authorization text the customer agreed to |
email, phone, billingAddress | The account holder's contact details |
Some connections require achMandate. The connection's guide says so. To change stored details later, see Keep billing details on a token.
Bank account rules
Preczn checks these rules when you create a token with POST /v1/tokens or PaymentElements:
| Field | Rule |
|---|---|
bankAccount.routing | Required. Exactly 9 digits |
bankAccount.account | Required. 4 to 17 digits |
bankAccount.type | Required. personalChecking, personalSavings, corporateChecking, or corporateSavings |
bankAccount.bankCountry | Required. USA only |
For the errors a failed check returns, see ACH errors.
Next
Charge the token with a sale. See ACH payments.
Updated 11 days ago
