API Documentation. See how easy it can be to add 200+ payment methods to your store.

Creating payments

The first step is to call Checkout URL for creating a new transaction.

G2A PAY Checkout will respond with the transaction identifier. The following step is to redirect to G2A PAY Checkout with new the transaction ID (received from API). Finally the user will be able to make a payment and be redirected to the merchant's website.

Starting a payment transaction

To start a online payment transaction merchant application call G2A PAY Checkout using the POST method.

The request contains payment details, merchant API key and calculated hash string.

Calculating hash

Hash is a crucial parameter for payment security. It is used specifically to avoid any tampering during the payment transaction process.

Hash is a string generated by hashing certain payment details using the SHA256 algorithm:

{userOrderId}{amount}{currency}{ApiSecret}
  • userOrderId – merchant's order ID
  • amount – payment amount, rounded to 2 decimals
  • currency – currency,
  • ApiSecret – API Secret generated in merchant panel (Settings > Merchant)

The SHA (Secure Hash Algorithm) is an cryptographic hash function. SHA-256 algorithm generates an almost-unique, fixed size 256-bit (32-byte) hash code. It is a one way function – it cannot be decrypted back. This algorithm is well suited for password validation, challenge hash authentication, digital signatures.

More details about generating hashes is in the Notifications section.

POST request

POST https://checkout.pay.g2a.com/index/createQuote

POST body

api_hash=38be425a-63d0-4c46-8733-3e9ff662d62d
&hash=ac0945d82b8589959b5f4ffafcc1a6c5983e82b8b4094c377a7b9c43d4a432bc
&order_id=2845
&amount=15
&currency=EUR
&email=stefan@my-test-store.com
&url_failure=http://my-test-store.com/order/fail
&url_ok=http://my-test-store.com/order/success
&items=[{"sku":"450","name":"Test Item","amount":"15","type":"item_type","qty":"1","price":15,"id":"5619","url":"http://example.com/products/item/example-item-name-5619"}]

Payment variables

Field
Data type
Required
Description
api_hash
string
Required
Store API Hash
hash
string
Required
Calculated hash
order_id
string
Required
Merchant order ID
amount
string
Required
Total order price
currency
string
Required
Currency (ISO 4217)
description
string
NO
Optional description
email
string
NO
Return e-mail
url_failure
string
Required
URL to redirect when payment fails
url_ok
string
Required
URL to redirect the payment is successful
cart_type
string
NO
Cart product type: physical or digital
items
array
Required
Array of payment items
items[].sku
string
Required
Item SKU
items[].name
string
Required
Item name
items[].amount
float
Required
Total item price (quantity x price)
items[].qty
integer
Required
Item quantity
items[].extra
string
NO
Item optional description
items[].type
string
NO
Item optional type
items[].id
string
Required
Unique item ID in your system
items[].price
float
Required
Single item price
items[].url
string
Required
Item URL
addresses
array
NO*
Array of addresses
addresses[].billing
array
Required
Array of billing address params
addresses[].shipping
array
Required
Array of shipping address params
addresses[].billing[].firstname
string
Required
First name
addresses[].billing[].lastname
string
Required
Last name
addresses[].billing[].line_1
string
Required
Billing address line 1
addresses[].billing[].line_2
string
Required
Billing address line 2(could be an empty string)
addresses[].billing[].zip_code
string
Required
Billing zip code (max length: 15 characters)
addresses[].billing[].city
string
Required
Billing city
addresses[].billing[].company
string
Required
Company name(could be an empty string)
addresses[].billing[].county
string
Required
Billing county/region
addresses[].billing[].country
string
Required
Country code(format ISO 3166-1 alpha-2)
addresses[].shipping[].firstname
string
Required
First name
addresses[].shipping[].lastname
string
Required
Last name
addresses[].shipping[].line_1
string
Required
Shipping address line 1
addresses[].shipping[].line_2
string
Required
Shipping address line 2(could be an empty string)
addresses[].shipping[].zip_code
string
Required
Shipping zip code (max length: 15 characters)
addresses[].shipping[].city
string
Required
Shipping city
addresses[].shipping[].company
string
Required
Company name(could be an empty string)
addresses[].shipping[].county
string
Required
Shipping county/region
addresses[].shipping[].country
string
Required
Country code(format ISO 3166-1 alpha-2)
process_payment
string
NO
Payment method or group to display (values: paypal, skrill or card)

* If an integrated merchant who sells physical products by default should provide us with billing and shipping address details. If a merchant sells physical products, all the above is required. Addresses params are not required if the merchant does not sell physical products. However, if the merchant has already provided us with the billing/shipping address details, then all fields are required. The billing and shipping address can be the same.

Order status response

{
"status": "ok",
"token": "54f863189b6db"
}

Redirect to payment gateway

After the payment transaction has been started successfully the user should be redirected to G2A PAY Payment Gateway Checkout Page with new token.

Example:

https://checkout.pay.g2a.com/index/gateway?token=54f863189b6db

After the user completes the payment transaction will be redirected to the merchant store – depending on the payment status they will be redirected either to url_ok or url_failure.

To url_ok will be passed GET parameter transactionId with newly created transaction ID.