DOCS
Build with the API

Save a payment method

Tokenize a card or bank account with the browser script, or with POST /v1/tokens.

Platform guide

A token is a saved payment method. Creating one does not charge anything. Store the token id from the response, and send it as tokenId whenever you pay, authorize, or send a payout.

From the browser

Collecting details in the browser keeps card and bank numbers off your server. Use the drop-in form or a custom form with the dhango script, and try both live in the client script guide.

The page needs only the account key, which can create tokens but cannot take payments. See API authentication.

From the server

POST /v1/tokens accepts one payment method object: card, ach, acss, auDirectDebit, bacs, nzDirectDebit, or sepa. The fields for each object, and which are required, are in the API reference for POST /v1/tokens.

For ACH, set validateAccount to true to validate the account before the token is stored. The flag applies only to ACH. You can also validate an account with a separate call. See Validate a bank account.

To use network tokenization, send userId and emailAddress. metadata is a dictionary of strings stored with the token, and address is optional.

Read and delete

GET /v1/tokens/{id} returns the token with the card or bank fields masked. DELETE /v1/tokens/{id} removes the token.

Who owns the token

The account you create the token for owns it.

  • In the browser, that is the account key you give the client script as tokenOwnerAccountKey. Use a merchant's key to store the token on that merchant, or your platform's key to store it on your platform.
  • From your server, a merchant's key and secret, or your platform key and secret with the merchant's accountKey, store the token on that merchant. Your platform key and secret on their own store it on your platform.

A token stored on your platform can be used for any merchant your platform manages.

See Token ownership.