REST API

Generating the Token Header

The token header is encrypted with a URL safe base64 algorithm. The following three header fields must be included in the header.
kid
The ID of the key used to digitally sign the JWT.
alg
Algorithm used to sign the token header.
v-c-merchant-id
Merchant ID used in the request transaction. To obtain the merchant ID, see Signing Up for a Sandbox Account.

Example: Token Header

eyJ2LWMtbWVyY2hhbnQtaWQiOiJtZXJjaGFudElEIiwiYWxnIjoiUlMyNTYiLCJraWQiOiI3MDc4NjMzMjg1MjUwMTc3MDQxNDk5In0

Code Example: Generating the Token Header with Python

Encode the header data and then remove any padding added during the encryption process.
import base64 # open file in binary mode data = b'{"v-c-merchant-id":"merchantID","alg":"RS256","kid":"7078633285250177041499"}' encoded = base64.urlsafe_b64encode(data) stripped = encoded.decode('ascii').strip('=') print(stripped)