Save a payment method
This guide explains how to save a payment method for reuse via tokenization with the Payabli API. This call exchanges sensitive payment information for a token that you can use to process future transactions.
PCI information
Because improperly handling customer card data can result in fines and impact your ability to process transactions, you must understand and fulfill PCI security requirements. When using the direct-access APIs, you must make sure that your systems and practices meet PCI requirements.
If you have any questions about how to maintain PCI compliance, reach out to the Payabli team.
Build the request
Send a POST request to /api/TokenStorage/add to save a payment method. For complete information, see the API reference for this endpoint.
This endpoint accepts several optional parameters that you can use to customize the request.
Creates a temporary, one-time-use token for the payment method that expires in 12 hours.
When true, enables real-time validation of ACH account. This is an add-on feature. Contact Payabli for more information.
When set to true, a new customer record will be created even if an existing customer record is found. Possible values: true or false. Default is false.
When true, the request doesn’t require you to pass the customerData object, and creates the token with no customer information attached. When the token is used to make a payment for the first time, it will be associated to the customer making the payment.
The response returns a ReferenceId, which is both the storedMethodId to use with transactions, and the methodId used to manage the payment method.
Examples
These examples show how to save various payment methods using the API.
Tokenize a card
This example shows how to save a card payment method. The request includes the customerData object with an existing customer’s ID 4440.
Returns a response like this:
Create anonymous Token
This example uses the createAnonymous parameter to create a token without customer information. The token is associated with the customer when it is used for the first time.
Returns a response like this:
Convert a temp token to permanent
This example converts a temporary token to a permanent token. The temporary parameter is set to true in the request, and the response returns a permanent token.
Returns a response like this:
Tokenize ACH
This example tokenizes an ACH payment method. The achValidation parameter is set to true to enable real-time validation of the ACH account.
Returns a response like this:
Managing tokenized payment methods
You can manage saved payment methods with the following endpoints: