Run a sale
After a customer enters their payment details into Hosted Fields, we tokenize them and return a single-use token. To run a sale, use the single-use token with our API.
The API method that you need to use depends on the payment type that the single-use token represents, for example, card details or bank account details.
Before you begin
Single-use token
Make sure that your integration can handle submissionSuccess events to receive a single-use token when a customer submits their payment details.
Headers
To create the header of each POST request, you must include the following parameters:
- Content-Type: Include application/json as the value for this parameter.
- Authorization: Include your Bearer token in this parameter.
- Idempotency-Key: Include a UUID v4 to make the request idempotent.
Errors
Make sure that your integration can handle errors. If a request is unsuccessful, we return an error that follows the RFC 7807 format. For more information about errors, go to Errors.
Integration steps
The method that you need to use to run the sale depends on the customer’s payment type:
- If the single-use token represents card details, go to Run a sale with card details.
- If the single-use token represents ACH or PAD details, go to Run a sale with bank account details.
Run a sale with card details
To run a sale with card details, send a 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].
For the paymentMethod object, send values for the following parameters:
- type: Send a value of
singleUseToken. - token: Send the single-use token that you received in the submissionSuccess event.
Request
Example request
Response fields
If your request is successful, our gateway uses the card details to run a sale. The response contains the following fields:
Response
Example response
Run a sale with bank account details
To run a sale with bank account details, send a 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].
For the paymentMethod object, send values for the following parameters:
- type: Send a value of
singleUseToken. - token: Send the single-use token that you received in the submissionSuccess event.
- accountType: Indicate if the bank account is a savings account or a checking account.
- secCode: If the single-use token represents ACH details, indicate how the customer authorized the payment.
Request
Example request
Response fields
If your request is successful, our gateway uses the bank account details to run a sale. The response contains the following fields: