Card Payment with Token

Once you have received the single-use token, you can use it to make a payment using the Card Payments API.

The single-use token is actually called token when created by the SDKs and paymentToken when created by the Vault. Also called paymentToken when used with Card Payments API in an Auth; with Direct Debit API in a Purchase; and with APMs in a Payment.

If your transactions are in multiple currencies you need to consider how you will handle the multiple merchant accounts involved and select the correct one to use when taking payment.

The payment endpoint uses the server-to-server API key. Do not use the Card Payments API from the client's web browser as this will expose this key.

Call the following endpoint from your server to take payment:

POST /cardpayments/v1/accounts/account_id/auths

Prior to trying the example, you should:

  • Replace the account number (1001087580) in the URL with the Test account number you received from Paysafe, according to the currency you wish to use. In this example, it's an ACH object.
  • Replace the API key user name and password (after the -u) with the Test API key you have received from Paysafe.
  • Substitute the paymentToken with the Test card token you obtained from Paysafe.js.

If your account has AVS (address verification system) enabled, you must include a billing address in the authorization call using the billingDetails object. The billing address is the address of the card represented by the payment token. Note that Developer Center test accounts have AVS enabled.

If the card specified or identified by a token in the request is enrolled in 3DS, there will be an authentication object in the response and this will contain details of the enrollment.

Converting a Single-Use Token to a Permanent Token

You can convert the single-use token to a re-usable permanent payment token by using it to create a profile in the Customer Vault—the paymentToken field returned in the card attribute contains the permanent token. Paysafe recommends that you verify that the single-use token corresponds to a valid card before creating the profile.

Did you find this page useful?