Each time you send a transaction to our REST API, you must authenticate your request. To do this, send the following parameters in the header of your request.
| Parameter | Description |
|---|---|
| Content-Type | Indicates the type of data that you are sending in the request. Send application/json. |
| Authorization | AuthTokenV2 which must be sent with each request. Please refer to the documentation below on how to create this value. |
| X-GP-Request-Id | GUID that you must generate for each request. The value for this parameter should have a prefix of MER-, for example MER-GUID. |
| X-GP-Version | Version of the API that you use in your integration. Send 2021-04-08. |
| X-GP-Api-Key | Your unique Partner REST API key for server-side requests. Note: if you are using Hosted Fields, you will have two keys, one for server-side requests and another for client-side (see below for more information on client-side / Hosted Fields). |
| X-GP-Partner-App-Name | Name of your application. |
For Card Present / Meet in the Cloud transactions an additional header is required which identifies the device that is initiating / processing the transaction.
| Parameter | Description |
|---|---|
| X-GP-Target-Device | Identifies the device sending the transaction in {Namespace}::{DeviceID} format. For Semi-Integrated Devices set the namespace to cedevice. For Tetra Lane 3000 set the namespace to rcm |
For Hosted Fields you will receive a dedicated client-side API Key that must be included in the JavaScript library configuration.
| Parameter | Description |
|---|---|
| X-GP-Api-Key | Your unique Partner REST API key for client-side requests. Note: if you are using Hosted Fields, you will have two keys, one for server-side requests and another for client-side. |
For Apple Pay and Google Pay transactions two additional parameters must be included in the JavaScript library configuration.
| Parameter | Description |
|---|---|
| X-GP-Merchant-Key | Unique identifier for the Merchant required to process Digital Wallet transactions. |
| Authorization | Digital Wallet transactions require an AuthTokenV2. For information on how to create the token, please refer to the documentation below. Note: in addition to the standard encryption for an AuthTokenV2, the account_credential must also be encrypted before being included in the payload. Please refer to the Encrypt account credentials section of Digital Wallets. |
An example configuration for Hosted Fields when using Digital Wallets.
GlobalPayments.configure( {
// Client-Side API Key
X-GP-Api-Key : "QwAnDXXXXXXXXXXXXXXXXXXXXXXETHqV",
// AuthTokenV2 with the account_credential encrypted inside the payload
Authorization : "AuthToken {{authTokenV2}}",
// Unique identifier for the Merchant
X-GP-Merchant-Key: "{{terminal-merchant-key}}"
X-GP-Environment : "test",
enableAutocomplete: true
});An AuthTokenV2 is a unique token that we use to verify requests to the REST API based on the JSON Web Token (JWT) standard, for more information see JWT. The token has a header.payload.signature format. In this guide, we’ll step through how to create each component, concatenate them and create the signature.
| Parameter | Description |
|---|---|
| alg | Type of algorithm for the signature. Send HS256. |
| typ | Type of token you want to create. Send JWT. |
{
"alg":"HS256",
"typ":"JWT"
}| Parameter | Description |
|---|---|
| type | Type of validation for the request. Send 'AuthTokenV2'. |
| region | Location of the request: US or CA. |
| account_credential | Credentials we provide you for authenticating your requests. Note: For Apple Pay transactions, the account_credential must be encrypted. |
| ts | Timestamp in milliseconds. |
{
"type":"AuthTokenV2",
"region":"US",
"account_credential":"8000000XXXXX:800XXXXX:xcviSXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"ts": 1521839766066
}In order to create the Signature, follow these steps:
HMACSHA256( base64UrlEncode(header) + "." + base64UrlEncode(payload), apiSecret)