Save payment details
Integrate with our API to create a secure token to represent a customer’s payment details. There are two ways to save the payment details in our vault and get a secure token:
- Save the payment details when running a sale.
- Save the payment details without running a sale.
When you create your request, you can assign an ID to the secure token. If you don’t, our gateway assigns an ID to the secure token. We return the secureTokenID and the token in the response, which the merchant uses in follow-on transactions, including:
- Create a payment with card details or bank account details.
- Create a refund with card details or bank account details.
- Look up BIN information.
Note: For more information about secure tokens, go to Tokenization.
Before you begin
Bearer tokens
Use our Identity Service to generate a Bearer token to include in the header of your requests. To generate your Bearer token, complete the following steps:
- Include your API key in the x-api-key parameter in the header of a POST request.
- Send your request to https://identity.payroc.com/authorize.
Note: You need to generate a new Bearer token before the previous Bearer token expires.
Example request
Example response
If your request is successful, we return a response that contains your Bearer token, information about its scope, and when it expires.
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
If your request is unsuccessful, we return an error. For more information about errors, see Errors.
Run a sale and save payment details
To run a sale and save the payment details, send a Create a Payment request. In the request, include a credentialOnFile object and set the tokenize parameter to true.
Our gateway runs the sale and saves the customer’s payment details in our vault. In the response, we return a secureTokenId and the token that the merchant can use for follow-on transactions.
Note: For more information about how to run a sale, go to Run a card sale or Run a sale with bank account details.
Save payment details
To save a customer’s payment details without running a sale, send a POST request to:
Request parameters
To create the body of your request, use the following parameters:
Request
Example request
Response fields
If your request is successful, we return a token that you can use instead of the customer’s payment details in follow-on transactions.