For additional flexibility with real-time, recurring, and card-on-file transactions, Merchants have the ability to securely save their customers' card payment and/or eCheck data by creating a token. By tokenizing a customer's payment method, Merchants can schedule future card-on-file charges and create recurring payment plans.
Tokens save the payment method while fully protecting the cardholder’s sensitive data, simplifying your PCI compliance requirements. Tokens do not expire.
How to Tokenize a Cardholder’s Payment Method
There are two ways in which a cardholder’s payment data can be saved for CoF & recurring billing transactions:
Creating a Customer in the Payrix Portal
Merchants have the ability to tokenize a cardholder’s payment method data directly in the Portal via the Customers section on the Dashboard menu. When creating a Customer, the Merchant will be prompted to enter the cardholder’s personal information, including name, address, and email address.
Once a Customer is created, the Merchant can attach a saved payment method (token) to that Customer for future CoF or recurring billing.
For our full step-by-step instructions for creating a Customer & attaching a tokenized payment method, please visit our Portal User Guide.
Tokenizing a Payment Method As You Submit a Transaction Via the API
A customer’s payment method can also be saved (tokenized) via the Payrix API. This is done by sending a POST request to the /tokens endpoint. Within the BODY of the request, you will include the customer’s information (name, address etc.), as well as the payment method (card/account number, exp. date etc.) that you would like to tokenize.
Technically, the customer’s address is not required when creating a token. However, we strongly recommend including it to prevent future payments from being blocked/declined due to AVS mismatch.
Please visit our API Reference for optional fields & additional information.
Location | Syntax |
---|---|
URL | [POST]https://api.payrix.com/tokens |
HEADER | Content-Type:application/json APIKEY:{{private_api_key}} |
BODY | { "customer":{ "first":"John", "last":"Smith", "email":"john@example.com", "address1":"123 Main Street", "city":"New York", "state":"NY", "zip":"12345", }, "payment":{ "number":"4242424242424242", "cvv":"123" }, "expiration":"0120" } |
Creating a Token Simultaneously As You Submit a Transaction
You also have the ability to tokenize a customer’s payment method simultaneously as you submit a transaction via the API. To do this, you will need to include the customer’s personal information within the BODY of your POST request to the /txns endpoint.
Please note, the syntax for creating a token simultaneously as you submit a transaction differs slightly for card payments and eCheck payments (as shown in the sample code below).
Location | Syntax |
---|---|
URL | [POST]https://api.payrix.com/txns |
HEADER | Content-Type:application/json APIKEY:{{private_api_key}} |
BODY (for card payments) | { "merchant": "t1_mer_59efbf4e69b27a4760b885d", "type": "1", "origin": "2", "token": { "payment": { "number": "4242424242424242", "cvv": "123", "expiration": "1020" }, "customer": { "first": "John", "last": "Smith", "email":"john@example.com", "address1":"123 Main Street", "city":"New York", "state":"NY", "zip":"12345", } }, "total": "10000" } |
BODY (for eCheck payments) | { "merchant": "t1_mer_59efbf4e69b27a4760b885d", "type": "7", "origin": "2", "token": { "payment": { "method": "8", "number": "123456789", "routing": "123456789" }, "customer": { "first": "First", "last": "Last", "email":"john@example.com", "address1":"123 Main Street", "city":"New York", "state":"NY", "zip":"12345", } }, "total": "10000" } |
Recurring Payments
One of the key features of Tokenizing a payment method is the ability for Merchants to use it to schedule recurring payments. This solution gives a Merchant the ability to charge their customer’s tokenized payment method in their desired amount and at their desired intervals. For example, Merchants can utilize recurring payments to charge their customers a monthly fee or for billing on a subscription-based business model.
Recurring payments can set up directly in the Portal, by creating a recurring payment Plan & subscribing their desired Customer/s to that Plan.
You can find step-by-step instructions for setting up recurring billing in the Payrix Portal here.
The Payrix Platform offers a Recurring Payments (/subscriptions) solution that enables you to schedule recurring transactions directly via our Portal.
As an alternative, you can create your own recurring transaction database. In this case, there are a few required fields you will need to submit in order to be in accordance with card brand mandates - see recurring payment guidelines here.
Because the customer's information (e.g. address) remains linked to each token, issuer declines due to AVS mismatch or similar are a lot less likely. If your client would like to be able to keep multiple payment methods on file, they can save multiple tokens per customer.
Saving AVS information on a Customer is not required to create a token. However, it is strongly recommended that it be saved to the record to increase successful recurring and card-on-file transactions with the token.