Authenticate an API call
Every API endpoint that requires authentication expects anauthorization HTTP-header
with a signed JWT token as its value (prefixed with bearer).
Create an API key
To sign a JWT you will need to create a new API key-pair in your dashboard. To create a new API key visit the Integrations panel in your dashboard and click the Add API key button. You can store the API key with your code or store it in a secure environment accessible to your application.
Merchants access
When selecting an API key, if your instance has Multi Merchant enabled then you can select whether the API key can access All merchants or only one. We recommend you restrict an API key to only one merchant account when integrating into Embed, our SDKs, or our e-commerce platforms like Magento, Salesforce Commerce Cloud, and Commerce Tools.Permissions
When selecting an API key, you can select whether to generate a key that has access to all APIs within the merchants it has access to (Full access) or only to APIs used for processing payments (Processing only). We recommend you use the Processing only for any API keys with our e-commerce platforms like Magento, Salesforce Commerce Cloud, and Commerce Tools.API access can be further reduced by setting a restrictive set of
scopes on the JWT.
Algorithm
Our API supports 2 algorithms for signing JWTs: ECDSA and RSA. We recommend you use ECDSA unless your environment does not support this stronger and newer algorithm. The RSA algorithm is available for those environments that do not support ECDSA. RSA keys provide considerably less security for the same key size and are currently not supported by our SDKs.Generate JWT
You might not want to use one of our SDKs, or an SDK in your language might not be available. In those cases you can construct, and sign the JWT with one of the many libraries available onjwt.io.
At the high level a JWT is build up out of 3 pieces:
- A header defining the algorithm and key used to create the JWT.
- A set of claims that define the token’s scope and other permissions.
- A cryptographic signature based on the header and the claims, signed using your private key.
jwt.io for more details on the specification and available
libraries for generating JWTs.
JWT header
The JWT header defines the type of encryption algorithm as well as the private key used to generate the signature.The
typ and alg are fixed and do not allow for other values. The kid is
the ID of your private key, which you can find in the Integrations panel of
your dashboard.JWT claims
The claims define when the token was created and what access it has.Claims
The API supports the following JWT claims.TimestampsPlease be aware that the
nbf, exp, and iat values are UNIX timestamps defined as seconds since January 1st, 1970 (UTC). Some programming languages will return UNIX timestamps as milliseconds,
requiring the removal of the last 3 digits.Scopes
The API supports the following values for thescopes claims.
The following resource names are recognized. Please see the reference documentation for more details as to what scope
is required per endpoint.
anti-fraud-servicesapi-logsbuyersbuyers.billing-detailscard-scheme-definitionscheckout-sessionsdigital-walletsflowspayment-methodspayment-method-definitionspayment-optionspayment-service-definitionspayment-servicesreportstransactions
Signature & assembly
Finally, the JWT signature is generated by appending the Base64 encoded header and claims (separated with a.) and run it through the key’s algorithm.