Environment Setup

Go2Joy API URL

Environment
URL
Rate Limiting

Staging

~250 requests/ minute

Production

~500 requests/ minute

  • Merchant provides IP for whitelist

  • APIs are calling via POST

  • APIs has Authorization by provide the signature via Authorization header

  • APIs provides 2 languages (Vietnamese, English) via Localization header

  • APIs needs default parameters: clientId, timestamp

Type
Parameters
Description

Header

Authorization*

Signature of partners

Header

Localization

The language for title (en, vi). Default is en

Body

timestamp*

The current timestamp when calling api. Expires in 5 minutes.

Body

clientId*

A secret key is distributed to partner.

How to configure authentication

1. Prerequisites

  • You already have client id and client secret key.

  • You already have a public app or web application.

2. Signature algorithm

Go2Joy verifies the identity of each API request, and the server will also verify whether the call parameters are valid. Therefore, each HTTP request must contain the signature information. The requests with invalid signature will be rejected.

This part explains how to generate an HMAC-SHA256 signature for an HTTP request. The request used to demonstrate signing is a POST (except list of Feed APIs) to https://partner.go2joy.vn/api/v1/hotel/getHotelInfo. The raw request looks like this sample:

3. Creating the signature base string

The two values collected must be joined to make a single string, from which the signature will be generated. This is called the signature base string.

Sort all request parameters according to the parameter name in ASCII table.

Example:

  • Before sort:

  • After sort:

The signature base string is formed by concatenating URL, |, raw HTTP body (raw HTTP body must be encoded).

There should be no space in the base string.

4. Client secret key

A secret key is distributed to partner when the registration is completed. Please keep the key as secret as your account password. Never disclose the key to anyone else.

5. Calculating the signature

Finally, the signature is calculated by passing the signature base string and client secret key to the HMAC-SHA256 hashing algorithm. The details of the algorithm are explained in depth here.

The output of the HMAC signing function is a binary string. This needs to be hex encoded to produce the signature string.

Example:

Sample code for PHP: