On This Page
REST API
Generating a JSON Web Token for a GET Request
Generate the Claim Set
Use the following key:value pair.
Field Name | Description | Example |
---|---|---|
iat | The date and time of message origin. The date can be in
any format for a time zone. This is a required field. |
|
Generate the Token Header
Use the following key:value pairs.
Field Name | Description | Example |
---|---|---|
x5c | The x5c (X.509 certificate chain) Header Parameter
contains the X.509 public key certificate or certificate chain corresponding
to the key(.p12) used to digitally sign the token.This is a required field. | MIICZTCCAc6gAwIBAg…Emj0F35Ew2ek4VezUXnZ/SMLvWEA6DG2sjSFCCuIot3mLJ3lI4AQSQSBSazhQec75Rk= |
alg | The signing algorithm used. This
is a required field. | alg: RS256 |
v-c-merchant-id | Merchant ID assigned in the Business Center. Required for merchant transactions. Required
for partners sending transactions of behalf of merchants. | v-c-merchant-id: merchant_id |
Example
{ "x5c": "MIICZTCCAc6gAwIBAg…Emj0F35Ew2ek4VezUXnZ/SMLvWEA6DG2sjSFCCuIot3mLJ3lI4AQSQSBSazhQec75Rk=", "alg": "RS256", "v-c-merchant-id": "merchant_id" }
Generate the Token Signature
Field Name | Description | Example |
---|---|---|
JWT Signature | Base64-encode the JWT header and the claim set created in previous steps to create the data
element. Join the resulting encoded strings together with a period (.) in between
them. In our pseudo code, this joined string is assigned to data.To get the JWT signature, the data string is signed
with RS256 with the private key using the signing algorithm specified in
the JWT header. Signature String is then encoded with Base64-encoded
before creating final token. | data = base64urlEncode( JWT header ) + “.” + base64urlEncode(
Claimset ) signature = RS256Hash( data, private_key ) ; signature
= eyJ2LWMtbWVyY2hhbn…WYQNLMOApxv6-DdcJZK4L9mLRc3gFb1kTFvodNEI6M0GeyoFp-b9PNG32TLQITYfWmZEbTZExgQHXGwwqo |
Generate the JSON Web Token
Field Name | Description | Example |
---|---|---|
JWT Token | With All three components JWT header , claim
set , and Signature , concatenate the components into a
valid JWT authorization token.JWT token = JWT header.Claim set.signature Combine
the header and payload and signature with periods (.) separating them. | Example: JWT Token = base64url( JWT header ) +
“.” + base64url( Payload ) + “.” + base64url( Signature ) //
Sample JWT header eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9 //
Sample PayLoad eyJ1c2VySWQiOiJiMDhmODZhZi0zNWRhLTQ4ZjItOGZhYi1jZWYz OTA0NjYwYmQifQ //
Sample signature -xN_h82PHVTCMA9vdoHrcZxH-x5mb11y1537t3rGzcM //
Sample JWT Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJiMDhm ODZhZi0zNWRhLTQ4ZjItOGZhYi1jZWYzOTA0NjYwYmQifQ.-xN_h82PHVTCMA9vdoHrcZxH-x5mb11y1537t3rGzcM |
Sample Code
Format/Example |
---|
Preparing payload:
Generating JWT Token—Header, Payload, and Signature:
|
After Generating the Header
To authenticate requests, place the JSON web token in an HTTP heading in the format:
Authorization: Bearer {token string}
where the {token string} is the string without curly braces.