Save a customer's payment details
An AI skill is available for this guide, get it on the Skills Marketplace (GitHub).
You can update your Hosted Fields integration to save a customer’s payment details as a secure token without charging the customer.
To tokenize the customer’s payment details, you need to update the Hosted Fields JavaScript configuration, and then send a request to our Secure Tokens endpoint.
You don’t need to change your authentication process for your existing Hosted Fields integration.
Before you begin
Make sure that you’ve set up your Hosted Fields integration to handle the single-use token from the submissionSuccess event. For more information, go to Run a sale.
Authenticate your requests before making API calls. If your request fails, see Errors.
Integration steps
- Update the JavaScript configuration.
- Convert the single-use token into a secure token.
Step 1. Update the JavaScript configuration
- In the JavaScript configuration, change the value for the mode parameter from payment to
tokenization.
Step 2. Convert the single-use token into a secure token
To convert the single-use token into a secure token, send a POST request to our Secure Tokens endpoint.
Request parameters
In the body of your request, include the singleUseToken from the submissionSuccess event in the source object. We also recommend that you assign a secureTokenId.
Request
Example request
Response fields
If your request is successful, our gateway converts the single-use token into a secure token. Our gateway returns the secure token in the token field. The response also contains the following fields:
Response
Response example
Using the secure token
After you receive the secure token that represents the customer’s payment details, you can use it in follow-up requests to our API, including:
- Create a card payment
- Create a bank transfer payment
- Update a customer’s payment details with Hosted Fields
Note: You can also use the secure token to set up repeat payments with our gateway, which requires more integration effort and cost. For more information, contact our Integrations Team at [email protected].