Skip to main content

GLODIPAY SERVER-TO-SERVER CARD API SPECIFICATION

Ask AI

VERSION 2.0.0

Table of Contents​

Use the Test environment. No real charges are made.

Without 3DS4111 1111 1111 111101/30029—
Without 3DS5555 5555 5555 444401/30029—
3DS Payment4012 8888 8888 188101/30029Success: 123456 / Fail: 111111
3DS Payment5111 1111 1111 111801/30029Success: 123456 / Fail: 111111
3DS Payment4141 4141 4141 414112/30123Success: 123456 / Fail: 111111

Introduction​

This document describes the GLODIPAY Server-to-Server (S2S) Card API v2, which allows merchants to submit card payment details directly from their own server, without redirecting the buyer to a GLODIPAY-hosted page.

Key features:

  • Direct card submission: Card number, expiry, and CVV are sent in the API request. The merchant is responsible for collecting card details securely on their own page (PCI DSS compliance required).
  • Auto-Cascade: When enabled, the gateway automatically retries failed charges across multiple providers. Only the final outcome is returned.
  • 3DS support: If the provider requires 3D Secure authentication, a redirect response is returned with a URL to complete verification. After 3DS, the result is sent via IPN and buyer is redirected.

Endpoints​

TestGet it from the API Keys page of the Sandbox Merchant Dashboard
ProductionGet it from the API Keys page of the Merchant Dashboard

Signature​

All requests must include a signature (RSA with MD5). Query responses, callback payloads and IPN payloads from GLODIPAY include a signature so you can verify them.

Generating a Signature (Merchant -> GLODIPAY)​

Sign request payloads with your RSA Private Key (obtained from the Merchant Dashboard).

GLODIPAY rebuilds the canonical string from the body it receives: it only removes signature, then sorts and trims. It does not drop empty fields or stringify nested data, so send exactly the payload you signed.

Steps:

  • Collect all request parameters except signature. Remove keys with empty string or null values.
  • Convert object/array values (e.g. metadata, browserDetails) to JSON strings.
  • Sort the keys in natural ascending order (SORT_NATURAL / localeCompare with numeric: true).
  • Trim whitespace from all string values (recursive).
  • Serialize to JSON string with all non-ASCII Unicode characters escaped to \uXXXX (RFC 8259).
  • Sign with md5WithRSAEncryption using your RSA Private Key.
  • Base64-encode the binary output.

Verifying a Signature (GLODIPAY -> Merchant)​

Verify GLODIPAY responses and webhooks with the RSA Public Key (available in the Portal).

Steps:

  • Separate signature from the payload.
  • Sort the remaining top-level keys in natural ascending order. Do not filter or stringify: values are already strings, empty fields are already omitted, and nested objects (fees, metadata, paymentMethodDetails) stay as objects.
  • Trim all string values (recursive).
  • Serialize to JSON string with all non-ASCII Unicode characters escaped to \uXXXX (RFC 8259).
  • Verify with md5WithRSAEncryption using your RSA Public Key.
  • Return value 1 = valid.

Note (Node.js): Convert all numeric values to strings before sorting/serializing. Escape forward slashes in the JSON string: .replace(///g, '/').

Note (Unicode / RFC 8259): The JSON payload must escape all non-ASCII Unicode characters (e.g., "a with accent" must become "\u00e1") before signing -- this is required by RFC 8259. In PHP, json_encode($data) does this by default -- do not use JSON_UNESCAPED_UNICODE. In Node.js, JSON.stringify() does not escape Unicode by default -- apply: .replace(/[^\\x00-\\x7F]/g, c => "\\u" + c.charCodeAt(0).toString(16).padStart(4, "0")) after serializing.

POST PAYMENT​

Submit card details directly from your server to process a card payment.

Endpoint: POST /v2/card/api Method: POST Content-Type: application/json

Request Parameters​

merchantIdString(1,50)MMerchant's ID
orderRefString(1,250)MYour transaction reference
amountFloatMInvoice amount. Minimum: 1. Up to 2 decimal places
currencyString(3)MISO 4217 currency code supported by your processor (usually USD only). E.g. USD
cancelUrlString(1,300)MURL to redirect buyer on cancellation.
callbackUrlString(1,300)MURL to redirect buyer after successful payment. Outside sandbox it must resolve to a public internet address.
notificationUrlString(1,300)MYour server endpoint to receive IPN webhooks. Outside sandbox it must resolve to a public internet address.
errorUrlString(1,300)MURL to redirect buyer on error.
orderDescriptionString(max:3000)OShort description of the order. HTML tags are removed
metadataString (JSON)OJSON-encoded string of key-value pairs. Returned in IPN and query responses
paymentMethodStringMMust be card for S2S card payments
feeBySellerNumber(0-100)OPercentage of processing fee paid by merchant. 0 = buyer pays 100%. Up to 2 decimal places
billingFirstNameString(max:255)MBilling first name
billingLastNameString(max:255)MBilling last name
billingStreet1String(max:255)MBilling street address line 1
billingStreet2String(max:255)OBilling street address line 2
billingCityString(max:255)MBilling city
billingEmailString(max:255)MBuyer email address; must be a valid email
billingStateString(min:2, max:255)CBilling state / province. Required when billingCountry is US or CA
billingCountryStringMISO 3166-1 alpha-2 country code
billingPostalCodeString(max:25)MPostal / ZIP code
billingPhoneCountryCodeString(max:10)OPhone country code. E.g. 1 for US
billingPhoneNumberString(max:30)MPhone number
cardNumberString(12,19)MCard number. E.g. 4111111111111111
cardMonthStringMExpiry month. E.g. 12
cardYearStringMExpiry year (2-digit). E.g. 30
cardSecurityCodeString(3,4)MCVV / CVC
customerIpStringMIP address of the customer; must be a valid IP
websiteUrlString(max:300)OMerchant website URL
signatureString(max:750)MRSA-MD5 signature. See Signature
expiresAtStringOSession expiry, UTC, format YYYY-MM-DDTHH:mm:ss.ffffffZ (6-digit microseconds). E.g. 2025-09-14T14:03:42.102862Z. Default: 24 hours
browserDetailsJSONCBrowser fingerprint. Required by some processors. See browserDetails Object

M = Mandatory, O = Optional, C = Conditional. Callback, notification, cancel and error URLs also accept the snake_case names callback_url, notification_url, cancel_url, error_url.

browserDetails Object​

Required on every S2S card request. Can be submitted as a JSON object (nested) or a JSON-encoded string. Keys are snake_case as listed below; camelCase keys are accepted and normalized.

accept_headerStringMBrowser Accept header. E.g. text/html,application/xhtml+xml
screen_widthStringMScreen width in pixels. E.g. 1920
screen_heightStringMScreen height in pixels. E.g. 1080
screen_color_depthStringMScreen color depth in bits. E.g. 24
window_widthStringMViewport width in pixels. E.g. 1440
window_heightStringMViewport height in pixels. E.g. 900
languageStringMBrowser language. E.g. en-US
java_enabledStringMWhether Java is enabled. "true" or "false"
user_agentStringMBrowser user agent string
time_zoneStringMUTC offset in hours. E.g. 7 for UTC+7
time_zone_nameStringMIANA timezone name. E.g. Asia/Ho_Chi_Minh
languagesArray<String>OOrdered list of browser preferred languages. E.g. ["vi-VN", "en-US", "en"]
platformString(max:255)OBrowser platform identifier. E.g. Win32, MacIntel, Linux x86_64
cookieEnabledBooleanOIndicates whether cookies are enabled in the browser
onlineBooleanOIndicates whether the browser reports an active network connection
hardwareConcurrencyIntegerONumber of logical CPU cores available to the browser. E.g. 8, 16
deviceMemoryNumberOApproximate device memory in GB reported by the browser. E.g. 4, 8, 16. May be unavailable on some browsers
availWidthIntegerOAvailable screen width excluding OS UI elements such as taskbars and docks
availHeightIntegerOAvailable screen height excluding OS UI elements such as taskbars and docks
currentUrlString(max:2048)OFull URL of the page where the payment request originated
hostnameString(max:255)OHostname (domain) of the current page. E.g. example.com

JavaScript snippet to collect browserDetails:

const browserDetails = {
accept_header: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
screen_width: String(window.screen.width),
screen_height: String(window.screen.height),
screen_color_depth: String(window.screen.colorDepth),
window_width: String(window.innerWidth),
window_height: String(window.innerHeight),
language: navigator.language || navigator.userLanguage,
java_enabled: String(navigator.javaEnabled ? navigator.javaEnabled() : false),
user_agent: navigator.userAgent,
time_zone: String(-new Date().getTimezoneOffset() / 60),
time_zone_name: Intl.DateTimeFormat().resolvedOptions().timeZone,

// ── Recommended fields (improves approval rate)
languages: navigator.languages,
platform: navigator.platform,
cookieEnabled: navigator.cookieEnabled,
online: navigator.onLine,
hardwareConcurrency: navigator.hardwareConcurrency,
deviceMemory: navigator.deviceMemory || "N/A",
availWidth: screen.availWidth,
availHeight: screen.availHeight,
currentUrl: location.href,
hostname: location.hostname,
};

Example Request​

{
"merchantId": "1100000123",
"orderRef": "ORDER-001",
"amount": "100.00",
"currency": "USD",
"paymentMethod": "card",
"callbackUrl": "https://yoursite.com/callback",
"notificationUrl": "https://yoursite.com/webhook",
"cancelUrl": "https://yoursite.com/cancel",
"errorUrl": "https://yoursite.com/error",
"websiteUrl": "https://yoursite.com",
"orderDescription": "Test order",
"billingFirstName": "John",
"billingLastName": "Doe",
"billingStreet1": "123 Main St",
"billingStreet2": "",
"billingCity": "New York",
"billingEmail": "john@example.com",
"billingState": "NY",
"billingCountry": "US",
"billingPostalCode": "10001",
"billingPhoneCountryCode": "1",
"billingPhoneNumber": "5551234567",
"cardNumber": "4111111111111111",
"cardMonth": "12",
"cardYear": "30",
"cardSecurityCode": "123",
"customerIp": "1.2.3.4",
"browserDetails": {
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"screen_width": "1920",
"screen_height": "1080",
"screen_color_depth": "24",
"window_width": "1440",
"window_height": "900",
"language": "en-US",
"java_enabled": "false",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"time_zone": "7",
"time_zone_name": "Asia/Ho_Chi_Minh"
},
"signature": "base64-encoded-signature"
}

Response​

Content-Type: application/json

Transaction completed (no 3DS required):

{
"status": "success",
"message": "The transaction has been successfully completed.",
"data": {
"transactionId": "01jwz13qfcx4z61ded3jcj0tf2"
}
}

3DS authentication required:

{
"status": "redirect",
"message": "Please redirect the user to complete the payment.",
"data": {
"transactionId": "01jwz0ty1640apxvmyzqpvc18a",
"url": "https://payment.gpayprocessing.com/card/authentication/01jwz0ty1640apxvmyzqpvc18a?url=eyJpdiI6..."
}
}

Redirect the buyer to data.url to complete 3DS. After verification, GLODIPAY processes the transaction and sends the result via IPN to notificationUrl and redirects the buyer to callbackUrl.

Pending (awaiting PSP confirmation):

{
"status": "pending",
"message": "pending",
"data": {
"transactionId": "01jwz0ty1640apxvmyzqpvc18a"
}
}

Validation error (HTTP 422):

{
"status": "error",
"message": "Invalid request data.",
"errors": [
{
"field": "billingEmail",
"message": ["The billing email field is required."]
}
]
}

Card declined (HTTP 400): no processor approved the charge. The message comes from the processor when available.

{
"status": "error",
"message": "No payment provider could process this transaction. Please try again or contact support.",
"data": {
"transactionId": "01jwz0ty1640apxvmyzqpvc18a"
}
}

Request not supported (HTTP 422): no transaction is created; data.transactionId is always null.

{
"status": "error",
"message": "No S2S payment service provider is configured for your merchant. Please contact support.",
"data": {
"transactionId": null
}
}
No S2S payment service provider is configured for your merchant. Please contact support.Only hosted-page (HPP) or iframe processors are active for the account
Your region is not currently supported. Please contact support.No active processor accepts the buyer's region
This transaction amount is not supported. Please contact support.amount is outside every active processor's range
Your card type is not supported. Please try a different card.No active processor accepts the card brand

Server error (HTTP 500): no data object. Messages: S2S payment is not enabled for your merchant. Please contact support., No active payment service providers found. Please contact support.

Merchant-level errors (invalid signature, merchant account not active, website domain not allowed) are checked before card processing. With connectionMode: "API" sent: HTTP 500 {"status": "error", "message": "..."}. With connectionMode omitted: HTTP 302 redirect to errorUrl?payload=<base64 JSON {status, ref, msg}>. An unknown merchantId returns HTTP 404.

Auto-Cascade: When enabled for the merchant account, the gateway automatically retries the card charge across all active PSPs in priority order before returning a final response. Individual PSP failures are suppressed during the cascade -- only the final outcome is returned and sent via IPN.

TRANSACTION QUERY​

Query the current status and full details of a transaction.

Endpoint: POST /v2/checkout/query Method: POST Content-Type: application/json

Request​

transactionIdString (ULID)MGLODIPAY transaction ID
signatureString(max:750)MRSA-MD5 signature

Response​

Content-Type: application/json

merchantIdStringMerchant's ID
transactionIdStringGLODIPAY transaction ID (ULID)
transactionNumberStringGLODIPAY human-readable transaction number
refStringMerchant's orderRef
currencyStringISO 4217 currency code
amountStringInvoice amount
paidAmountStringAmount actually charged to buyer (including buyer fees)
settlementAmountStringAmount to be settled to merchant
estimationSettlementAtISO 8601 datetimeEstimated settlement datetime
feesJSONFee breakdown. See fees Object
statusStringTransaction status. See Status Values
statusCodeStringNumeric status code as a string. See Status Codes
metadataJSONmetadata from the original session, decoded to an object (values as strings)
paymentMethodDetailsJSONPayment method used. See paymentMethodDetails Object
transactionCreatedAtISO 8601 datetimeTransaction creation time in GLODIPAY system
originalTransactionCreatedAtISO 8601 datetimeTransaction creation time at the PSP
signatureStringRSA-MD5 signature -- verify with GLODIPAY public key

The transaction object is returned at the top level (no status/data wrapper), without message and descriptor. All values are strings; empty fields are omitted. If you send the ID of the first attempt (group ID), the latest attempt is returned.

Errors (HTTP 200, no status field, first error only):

{
"errors": [
{ "field": "signature", "message": "signature is invalid." }
]
}
transactionId / signatureValidation messageMissing field, transactionId not a ULID, signature over 750 characters
signaturesignature is invalid.Signature check failed
nullMerchant status is {status}Merchant account not active

NOTIFICATION​

GLODIPAY sends an HTTP POST to your notificationUrl when a transaction reaches a terminal state.

Method: POST Content-Type: application/json

Delivery: Timeout 15 seconds (5 seconds to connect). notificationUrl must resolve to a public address. No automatic retry: a notification counts as delivered only when you return {"returnCode":"100"}; any other response or a timeout is recorded and not re-sent on a schedule. Use Transaction Query to recover a missed result, and handle duplicates idempotently.

Value format: every value is sent as a string (e.g. "100.00", "6"). Fields that are empty, null or zero are omitted.

Payload​

merchantIdStringMMerchant's ID
transactionIdStringMGLODIPAY transaction ID (ULID)
transactionNumberStringMGLODIPAY human-readable transaction number
refStringMMerchant's orderRef
currencyStringMISO 4217 currency code
amountStringMInvoice amount
paidAmountStringOAmount actually charged to buyer (including buyer fees)
settlementAmountStringOAmount to be settled to merchant
estimationSettlementAtISO 8601 datetimeOEstimated settlement datetime
feesJSONOFee breakdown. See fees Object
paymentMethodDetailsJSONOPayment method used. See paymentMethodDetails Object
statusStringMTransaction status. See Status Values
statusCodeStringMNumeric status code as a string. See Status Codes
metadataJSONOKey-value pairs from the original session
messageStringOHuman-readable status message
descriptorStringOTransaction descriptor
transactionCreatedAtISO 8601 datetimeMTransaction creation time in GLODIPAY system
originalTransactionCreatedAtISO 8601 datetimeMTransaction creation time at the PSP
signatureStringMRSA-MD5 signature -- verify with GLODIPAY public key

fees Object​

buyerStringBuyer-facing fee amount
sellerStringMerchant fee amount
rollingStringRolling reserve amount
operateStringTotal operating fees (processor + GLODIPAY + partner)
estimationRollingReleaseAtISO 8601 datetimeEstimated rolling reserve release datetime

paymentMethodDetails Object​

displayNameStringPayment method label
groupStringPayment method group type
familyStringPayment method family type
typeStringPayment method type
{type}JSONOptional. Payment method-specific details. Key equals the type value (e.g. card). Omitted when the provider returns no details. See card Object below.

card Object (paymentMethodDetails.card)​

nameCardholder name
firstSixDigitsFirst 6 digits of card number (BIN)
lastFourDigitsLast 4 digits of card number
expiryMonthExpiry month (MM)
expiryYearExpiry year (YY)
typeCard brand (visa, mastercard, amex, etc.)
issuerIssuing bank name (provider-dependent)
issuerCountryCodeISO 3166-1 alpha-2 country code of issuing bank (provider-dependent)
fundingCard funding type (credit, debit, prepaid) (provider-dependent)
authorizationCodeAuthorization code from issuer (provider-dependent)
clientIPCustomer IP address at time of payment (provider-dependent)
checksAVS/CVC verification results (provider-dependent)
threeDSecure3D Secure authentication details (provider-dependent)

Example IPN Payload:

{
"merchantId": "1100000123",
"transactionId": "01jwz13qfcx4z61ded3jcj0tf2",
"transactionNumber": "2604-1713100800",
"ref": "ORDER-001",
"currency": "USD",
"amount": "100.00",
"paidAmount": "105.00",
"settlementAmount": "95.00",
"estimationSettlementAt": "2026-04-16T00:00:00+00:00",
"fees": {
"buyer": "5.00",
"seller": "5.00",
"rolling": "2.00",
"operate": "3.00",
"estimationRollingReleaseAt": "2026-05-14T00:00:00+00:00"
},
"status": "successful",
"statusCode": "6",
"paymentMethodDetails": {
"displayName": "Credit / Debit Card",
"group": "card",
"family": "card",
"type": "card"
},
"metadata": { "orderId": "12345" },
"transactionCreatedAt": "2026-04-14T10:00:00+00:00",
"originalTransactionCreatedAt": "2026-04-14T10:00:01+00:00",
"signature": "base64-encoded-rsa-signature"
}

Response (Merchant -> GLODIPAY)​

Your server must respond within 15 seconds (no automatic retry):

{
"returnCode": "100",
"description": "Received"
}
returnCodeStringMMust be "100" to acknowledge receipt
descriptionString(1,1500)OOptional description

Simulating Payments​

Use the Test environment. No real charges are made.

Without 3DS4111 1111 1111 111101/30029—
Without 3DS5555 5555 5555 444401/30029—
3DS Payment4012 8888 8888 188101/30029Success: 123456 / Fail: 111111
3DS Payment5111 1111 1111 111801/30029Success: 123456 / Fail: 111111
3DS Payment4141 4141 4141 414112/30123Success: 123456 / Fail: 111111

Appendix​

Status Values​

String values returned in the status field of IPN payloads and query responses.

incompleteTransaction initiated, awaiting action
pendingAwaiting payment confirmation
under_reviewTransaction under review
successfulPayment completed successfully
failedPayment failed
errorSystem error occurred
canceledTransaction canceled
rejectedTransaction rejected
expiredTransaction expired
processedTransaction was submitted to the payment provider
releasedFunds released / settled
documents_uploadedSupporting documents uploaded
refund_initiatedRefund request initiated
refund_under_reviewRefund under review
refund_successfulRefund completed successfully
refund_failedRefund failed
refund_partially_successfulPartial refund completed
refund_partially_failedPartial refund failed
void_initiatedVoid initiated
void_under_reviewVoid under review
void_successfulVoid completed successfully
void_failedVoid failed
void_partially_successfulPartial void completed
void_partially_failedPartial void failed
chargeback_alertChargeback alert received
chargebackedTransaction chargebacked
disputeDispute opened

Status Codes​

Numeric code in the statusCode field of IPN payloads and query responses.

1incompleteTransaction initiated
2pendingPending confirmation
3errorSystem error
4failedPayment failed
5under_reviewUnder review
6successfulPayment successful
7releasedReleased / settled
8refund_initiatedRefund initiated
9refund_failedRefund failed
10refund_under_reviewRefund under review
11refund_successfulRefund successful
12refund_partially_failedPartial refund failed
13refund_partially_successfulPartial refund successful
14canceledCanceled
15rejectedRejected
16expiredExpired
17documents_uploadedDocuments uploaded
18void_initiatedVoid initiated
19void_under_reviewVoid under review
20void_successfulVoid successful
21void_failedVoid failed
22void_partially_successfulPartial void successful
23void_partially_failedPartial void failed
24chargeback_alertChargeback alert
25chargebackedChargebacked
26disputeDispute opened
27processedProcessed

Currency Codes​

GLODIPAY follows the ISO 4217 standard. The accepted currency depends on the payment provider configured for your merchant account. Common supported values:

USDUnited States Dollar
EUREuro
GBPPound Sterling
AUDAustralian Dollar
AEDUAE Dirham
VNDVietnamese Dong

Country Codes​

GLODIPAY uses ISO 3166-1 alpha-2 two-letter codes for billingCountry.

ADAndorra
AEUnited Arab Emirates
AFAfghanistan
AGAntigua and Barbuda
AIAnguilla
ALAlbania
AMArmenia
AOAngola
AQAntarctica
ARArgentina
ASAmerican Samoa
ATAustria
AUAustralia
AWAruba
AXÅland Islands
AZAzerbaijan
BABosnia and Herzegovina
BBBarbados
BDBangladesh
BEBelgium
BFBurkina Faso
BGBulgaria
BHBahrain
BIBurundi
BJBenin
BLSaint Barthélemy
BMBermuda
BNBrunei Darussalam
BOBolivia, Plurinational State of
BQBonaire, Sint Eustatius and Saba
BRBrazil
BSBahamas
BTBhutan
BVBouvet Island
BWBotswana
BYBelarus
BZBelize
CACanada
CCCocos (Keeling) Islands
CDCongo, Democratic Republic of the
CFCentral African Republic
CGCongo
CHSwitzerland
CICôte d'Ivoire
CKCook Islands
CLChile
CMCameroon
CNChina
COColombia
CRCosta Rica
CUCuba
CVCabo Verde
CWCuraçao
CXChristmas Island
CYCyprus
CZCzechia
DEGermany
DJDjibouti
DKDenmark
DMDominica
DODominican Republic
DZAlgeria
ECEcuador
EEEstonia
EGEgypt
EHWestern Sahara
EREritrea
ESSpain
ETEthiopia
FIFinland
FJFiji
FKFalkland Islands (Malvinas)
FMMicronesia, Federated States of
FOFaroe Islands
FRFrance
GAGabon
GBUnited Kingdom of Great Britain and Northern Ireland
GDGrenada
GEGeorgia
GFFrench Guiana
GGGuernsey
GHGhana
GIGibraltar
GLGreenland
GMGambia
GNGuinea
GPGuadeloupe
GQEquatorial Guinea
GRGreece
GSSouth Georgia and the South Sandwich Islands
GTGuatemala
GUGuam
GWGuinea-Bissau
GYGuyana
HKHong Kong
HMHeard Island and McDonald Islands
HNHonduras
HRCroatia
HTHaiti
HUHungary
IDIndonesia
IEIreland
ILIsrael
IMIsle of Man
INIndia
IOBritish Indian Ocean Territory
IQIraq
IRIran, Islamic Republic of
ISIceland
ITItaly
JEJersey
JMJamaica
JOJordan
JPJapan
KEKenya
KGKyrgyzstan
KHCambodia
KIKiribati
KMComoros
KNSaint Kitts and Nevis
KPKorea, Democratic People's Republic of
KRKorea, Republic of
KWKuwait
KYCayman Islands
KZKazakhstan
LALao People's Democratic Republic
LBLebanon
LCSaint Lucia
LILiechtenstein
LKSri Lanka
LRLiberia
LSLesotho
LTLithuania
LULuxembourg
LVLatvia
LYLibya
MAMorocco
MCMonaco
MDMoldova, Republic of
MEMontenegro
MFSaint Martin (French part)
MGMadagascar
MHMarshall Islands
MKNorth Macedonia
MLMali
MMMyanmar
MNMongolia
MOMacao
MPNorthern Mariana Islands
MQMartinique
MRMauritania
MSMontserrat
MTMalta
MUMauritius
MVMaldives
MWMalawi
MXMexico
MYMalaysia
MZMozambique
NANamibia
NCNew Caledonia
NENiger
NFNorfolk Island
NGNigeria
NINicaragua
NLNetherlands, Kingdom of the
NONorway
NPNepal
NRNauru
NUNiue
NZNew Zealand
OMOman
PAPanama
PEPeru
PFFrench Polynesia
PGPapua New Guinea
PHPhilippines
PKPakistan
PLPoland
PMSaint Pierre and Miquelon
PNPitcairn
PRPuerto Rico
PSPalestine, State of
PTPortugal
PWPalau
PYParaguay
QAQatar
RERéunion
RORomania
RSSerbia
RURussian Federation
RWRwanda
SASaudi Arabia
SBSolomon Islands
SCSeychelles
SDSudan
SESweden
SGSingapore
SHSaint Helena, Ascension and Tristan da Cunha
SISlovenia
SJSvalbard and Jan Mayen
SKSlovakia
SLSierra Leone
SMSan Marino
SNSenegal
SOSomalia
SRSuriname
SSSouth Sudan
STSao Tome and Principe
SVEl Salvador
SXSint Maarten (Dutch part)
SYSyrian Arab Republic
SZEswatini
TCTurks and Caicos Islands
TDChad
TFFrench Southern Territories
TGTogo
THThailand
TJTajikistan
TKTokelau
TLTimor-Leste
TMTurkmenistan
TNTunisia
TOTonga
TRTürkiye
TTTrinidad and Tobago
TVTuvalu
TWTaiwan, Province of China
TZTanzania, United Republic of
UAUkraine
UGUganda
UMUnited States Minor Outlying Islands
USUnited States of America
UYUruguay
UZUzbekistan
VAHoly See
VCSaint Vincent and the Grenadines
VEVenezuela, Bolivarian Republic of
VGVirgin Islands (British)
VIVirgin Islands (U.S.)
VNViet Nam
VUVanuatu
WFWallis and Futuna
WSSamoa
YEYemen
YTMayotte
ZASouth Africa
ZMZambia
ZWZimbabwe

Also accepted: AC (Ascension Island), AN (Netherlands Antilles), CP (Clipperton Island), CS (Serbia and Montenegro), IC (Canary Islands), IH, XK (Kosovo), XX.

Card Types​

1VISAvisa
2MASTERCARDmastercard
3AMERICAN EXPRESSamex
4JCBjcb
5MAESTROmaestro
6DISCOVERdiscover
7UNION PAYunion-pay
8DINERSdiners

Code Examples​

PHP​

<?php

function generateSignature(array $data): string
{
$privateKey = openssl_pkey_get_private("-----BEGIN PRIVATE KEY-----
YOUR_PRIVATE_KEY_HERE
-----END PRIVATE KEY-----
");

foreach ($data as $k => $v) {
if (is_array($v)) $data[$k] = json_encode($v);
}
ksort($data, SORT_NATURAL);
array_walk_recursive(
$data,
static function (&$field) {
$field = trim($field);
}
);

openssl_sign(json_encode($data), $signature, $privateKey, 'md5WithRSAEncryption');

return base64_encode($signature);
}

function verifySignature(array $data): bool
{
$publicKey = openssl_pkey_get_public("-----BEGIN PUBLIC KEY-----
YOUR_GLODIPAY_PUBLIC_KEY_HERE
-----END PUBLIC KEY-----
");

$dataWithoutSignature = array_filter($data, static function ($key) {
return $key !== 'signature';
}, ARRAY_FILTER_USE_KEY);

$signature = $data['signature'];

ksort($dataWithoutSignature, SORT_NATURAL);
array_walk_recursive(
$dataWithoutSignature,
static function (&$field) {
$field = trim($field);
}
);

$result = openssl_verify(
json_encode($dataWithoutSignature),
base64_decode($signature),
$publicKey,
'md5WithRSAEncryption'
);

return $result === 1;
}

// Example: S2S card payment
$payload = [
'merchantId' => '1100000123',
'orderRef' => 'ORDER-' . time(),
'amount' => '100.00',
'currency' => 'USD',
'paymentMethod' => 'card',
'callbackUrl' => 'https://yoursite.com/payment/callback',
'notificationUrl' => 'https://yoursite.com/payment/webhook',
'cancelUrl' => 'https://yoursite.com/payment/cancel',
'errorUrl' => 'https://yoursite.com/payment/error',
'orderDescription' => 'Test order',
'billingFirstName' => 'John',
'billingLastName' => 'Doe',
'billingStreet1' => '123 Main St',
'billingStreet2' => '',
'billingCity' => 'New York',
'billingEmail' => 'john@example.com',
'billingState' => 'NY',
'billingCountry' => 'US',
'billingPostalCode' => '10001',
'billingPhoneCountryCode'=> '1',
'billingPhoneNumber' => '5551234567',
'cardNumber' => '4111111111111111',
'cardMonth' => '12',
'cardYear' => '30',
'cardSecurityCode' => '123',
'customerIp' => $_SERVER['REMOTE_ADDR'],
];

$payload['signature'] = generateSignature($payload);

$ch = curl_init('https://payment-sandbox.gpayprocessing.com/v2/card/api');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);

if ($result['status'] === 'redirect') {
// Redirect buyer for 3DS
header('Location: ' . $result['data']['url']);
exit;
} elseif ($result['status'] === 'success') {
// Payment completed immediately
echo 'Payment successful. TransactionId: ' . $result['data']['transactionId'];
}

Node.js​

// Save as script.mjs and run: node script.mjs
import { createSign } from 'crypto';
import https from 'https';

const PRIVATE_KEY = `-----BEGIN PRIVATE KEY-----
YOUR_PRIVATE_KEY_HERE
-----END PRIVATE KEY-----`;

function phpCast(v) {
if (typeof v === 'number') return String(v);
if (typeof v === 'boolean') return v ? '1' : '';
if (typeof v === 'string') return v.trim();
if (Array.isArray(v)) return v.map(phpCast);
if (v && typeof v === 'object') return Object.fromEntries(Object.entries(v).map(([k, val]) => [k, phpCast(val)]));
return v;
}

function generateSignature(data) {
const sorted = {};
Object.keys(data)
.filter(k => k !== 'signature')
.sort((a, b) => a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' }))
.forEach(k => { sorted[k] = data[k]; });

const canonical = JSON.stringify(phpCast(sorted))
.replace(/\//g, '\\/')
.replace(/[\u0080-\uffff]/g, c => '\\u' + c.charCodeAt(0).toString(16).padStart(4, '0'));

const sign = createSign('md5WithRSAEncryption');
sign.update(canonical);
return sign.sign(PRIVATE_KEY, 'base64');
}

const payload = {
merchantId: '1100000123',
orderRef: 'ORDER-' + Date.now(),
amount: '100.00',
currency: 'USD',
paymentMethod: 'card',
callbackUrl: 'https://yoursite.com/payment/callback',
notificationUrl: 'https://yoursite.com/payment/webhook',
cancelUrl: 'https://yoursite.com/payment/cancel',
errorUrl: 'https://yoursite.com/payment/error',
orderDescription: 'Test order',
billingFirstName: 'John',
billingLastName: 'Doe',
billingStreet1: '123 Main St',
billingStreet2: '',
billingCity: 'New York',
billingEmail: 'john@example.com',
billingState: 'NY',
billingCountry: 'US',
billingPostalCode: '10001',
billingPhoneCountryCode: '1',
billingPhoneNumber: '5551234567',
cardNumber: '4111111111111111',
cardMonth: '12',
cardYear: '30',
cardSecurityCode: '123',
customerIp: '1.2.3.4',
};

payload.signature = generateSignature(payload);

const postData = JSON.stringify(payload);
const options = {
hostname: 'payment-sandbox.gpayprocessing.com',
path: '/v2/card/api',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(postData),
},
};

const req = https.request(options, (res) => {
let body = '';
res.on('data', chunk => body += chunk);
res.on('end', () => {
const result = JSON.parse(body);
if (result.status === 'redirect') {
console.log('Redirect buyer to:', result.data.url);
} else if (result.status === 'success') {
console.log('Payment completed. TransactionId:', result.data.transactionId);
}
});
});

req.on('error', console.error);
req.write(postData);
req.end();

Bookmarks

No bookmarks yet.
Hover over a heading and click to save a section.