Save payment details when running a sale
Save payment details when running a sale
You can use the single-use token from your existing Hosted Fields integration to save a customer’s payment details at the same time that you run a sale.
If you save a customer’s payment details during a sale, our gateway uses the single-use token from Hosted Fields to charge the customer, and then saves the customer’s payment details as a secure token. You can use the secure token multiple times, and it doesn’t expire.
To tokenize payment details during a sale, you need to send some additional parameters in your request to our API. You don’t need to change the JavaScript configuration or authentication for your existing Hosted Fields integration.
Before you begin
Make sure that you’ve set up your Hosted Fields integration to run a sale with 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
The steps that you need to follow depend on whether your single-use token represents card details or bank account details:
- If the single-use token represents card details, go to Save card details when you run a sale.
- If the single-use token represents bank account details, go to Save bank account details when you run a sale.
Save card details when you run a sale
To run a sale and tokenize the card details, you need to update your POST request to our Payments endpoint.
Request parameters
Important: The request includes parameters for functions and features that we don’t cover in this guide. These functions and features might require additional integration effort and cost. For more information, contact our Integrations Team at [email protected].
To save a customer’s card details when you run a sale, update your request to our Payments endpoint. Send the single-use token from Hosted Fields in the paymentMethod object, and include the following parameters in the credentialOnFile object:
tokenize- Send a value oftrue.secureTokenId- Assign a unique identifier to the secure token.
Note: If you want to use the stored payment details to run repeat payments with your own software, include the standingInstructions object in your request. For more information about repeat payments with Hosted Fields, go to Repeat payments with Hosted Fields.
Request
Example request
Response fields
If your request is successful, our gateway runs the sale and converts the single-use token into a secure token that we return in the response. You need to store the token so that you can use it in follow-up requests.
The response also contains the following fields:
Response
Example response
Save bank account details when you run a sale
To run a sale and tokenize the bank account details, you need to update your POST request to our Bank Transfer Payments endpoint.
Request parameters
Important: The request includes parameters for functions and features that we don’t cover in this guide. These functions and features might require additional integration effort and cost. For more information, contact our Integrations Team at [email protected].
To save a customer’s bank account details when you run a sale, update your request to our Bank Transfer Payments endpoint. Send the single-use token from Hosted Fields in the paymentMethod object, and include the following parameters in the credentialOnFile object:
tokenize- Send a value oftrue.secureTokenId- Assign a unique identifier to the secure token.
Request
Example request
Response fields
If your request is successful, our gateway runs the sale and converts the single-use token into a secure token that we return in the response. You need to store the token so that you can use it in follow-up requests.
The response also contains the following fields:
Response
Example response
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].