Algorithms at a glance
| Concern | Algorithm | Key size |
|---|---|---|
| Payload encryption | AES/ECB/PKCS7Padding | 128-bit session key |
| Session key protection | RSA/ECB/PKCS1Padding | 2048-bit RSA |
| Message signing | SHA1withRSA | 2048-bit RSA |
| Transport | HTTPS 1.2 | — |
| Text encoding | UTF-8 | — |
| Content-Type | application/json | — |
POST parameters
Every API call is a single HTTPS POST. The request body carries exactly four top-level fields:| Parameter | Type | Description |
|---|---|---|
merchantNo | String | Your unique merchant identifier, assigned during onboarding. Included in plaintext so the server can look up your public key. |
jsonEnc | String | Base64-encoded AES ciphertext of your JSON payload. |
keyEnc | String | HEX-encoded RSA ciphertext of the Base64 AES session key. Encrypted with the recipient’s RSA public key. |
sign | String | HEX-encoded SHA1withRSA signature over the JSON plaintext, computed with the sender’s RSA private key. |
merchantNo travels in plaintext intentionally — Gcashier Pay uses it to retrieve your RSA public key for signature verification before decrypting anything.Request and response envelope
Before encryption, every payload shares a common JSON envelope withhead and body sections.
Request structure
Response structure
Head field reference
| Field | Direction | Type | Description |
|---|---|---|---|
version | Both | String | API version. Current value: "1.0.0". |
tradeType | Both | String | "00" for requests; "01" for responses. |
tradeTime | Both | String | Unix timestamp (10-digit seconds). Echo’d back in responses. |
tradeCode | Both | String | Identifies the API operation (e.g. "sp1301" for RMB payment). |
language | Both | String | Response language preference. "cn" for Chinese, "en" for English. |
respCode | Response only | String | Result code. "S00000" = success; all other values indicate an error. |
respDesc | Response only | String | Human-readable description of respCode. |
Outgoing request: encryption and signing
The following steps describe exactly what you must do to build a valid outgoing request.Build the JSON plaintext
Assemble your complete request object —
head plus all required body fields for the target API operation. Serialize it to a UTF-8 JSON string. This is the value you sign and then encrypt.Sign the plaintext with SHA1withRSA → HEX
Compute a digital signature over the JSON plaintext using your RSA private key and the SHA1withRSA algorithm. Encode the raw signature bytes as a lowercase HEX string. This becomes the
sign POST parameter.Generate an AES session key → Base64
Use a cryptographically secure random generator to produce a fresh 128-bit AES key for this request. Base64-encode the raw key bytes. This is your session key A new
SK.SK must be generated for every request. Reusing session keys undermines forward secrecy.Encrypt the JSON plaintext with SK → Base64
Encrypt the JSON plaintext bytes using AES/ECB/PKCS7Padding with the session key
SK. Base64-encode the resulting ciphertext. This becomes the jsonEnc POST parameter.Encrypt SK with Gcashier Pay's RSA public key → HEX
Encrypt the Base64-encoded session key string using Gcashier Pay’s RSA public key with RSA/ECB/PKCS1Padding. HEX-encode the resulting ciphertext. This becomes the
keyEnc POST parameter.Incoming response: decryption and verification
When Gcashier Pay responds, you receive the same four-field envelope. Process it in this order:Recover the session key from keyEnc
HEX-decode the
keyEnc value to get the raw encrypted bytes, then decrypt those bytes with your own RSA private key using RSA/ECB/PKCS1Padding. The result is the Base64-encoded session key SK.Decrypt the payload from jsonEnc
Base64-decode both
jsonEnc and SK to their raw byte forms, then apply AES/ECB/PKCS7Padding decryption. The result is the UTF-8 JSON plaintext.The merchantNo field
Your merchantNo is assigned by Gcashier Pay during merchant onboarding. It appears as both a top-level POST parameter (in plaintext) and often as a field inside the encrypted body for certain API operations. The plaintext copy allows Gcashier Pay to resolve your public key before performing any cryptographic operation.
The accessToken field
Some APIs — particularly FX trading and workflows that follow merchant onboarding — require an additional accessToken field inside the head object of the encrypted payload.
accessToken after your merchant account has been approved through the onboarding API. The token proves your merchant entity has been verified and is required for operations that carry regulatory or financial risk. When an accessToken is required, the individual API reference page will say so explicitly.
