Authenticate your session
An AI skill is available for this guide, get it on the Skills Marketplace (GitHub).
To authenticate your access to the Payroc gateway, include a session token every time you run the Hosted Fields script on a webpage.
Before you begin
- Make sure you have your API key for both the test environment and the production environment.
- 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
Step 1. Generate a Bearer token.
Step 2. Generate a session token from the Bearer token.
Step 1. Generate a Bearer token
Authenticate your requests to generate a Bearer token.
Step 2. Generate a session token from the Bearer token
You must use our Hosted Fields Sessions endpoint to generate a new session token each time you initialize Hosted Fields. A session token expires after 10 minutes.
When you generate a session token, you need to specify the version of the Hosted Fields JavaScript library that you are using. Include the version number in the libVersion parameter in the body of your request.
Request
To generate a session token, send a POST request to our Processing Terminals endpoint.
Include the following headers in your request:
- Content-Type: Include
application/jsonas the value for this parameter. - Authorization: Include your Bearer token in this parameter.
- Idempotency-Key: Include a UUID v4 to make the request idempotent.
To create the body of your request, use the following parameters:
Request
Example request
Response fields
If your request is successful, our gateway generates a session token. The response contains the following fields: