API Documentation

Introduction to Payment API

G2A PAY provides several online payment methods such as credit cards, PayPal or G2A Wallet payments. You can quickly activate them in your e-commerce system.

This documentation features the possible methods of implementing on-line payments with G2A PAY. The first part introduces the payment service whereas the second one presents the possible ways of integration.

Payment flow

A payment is processed via G2A PAY in two steps:

  • The buyer places an order on the merchant eCommerce application.
  • G2A PAY processes the payment and confirms that the payment is correctly settled.
Online Payment Flow Chart
  1. In the merchant's shopping cart the Buyer uses the G2A PAY button to start the payment process.
  2. In the G2A PAY Checkout the user selects a payment method, provides the details and finalizes the payment.
  3. The G2A PAY Checkout redirects the user to the merchant's order summary page with an appropriate payment status.

Payment status

The diagram below shows how the payment status changes during the entire process.

Online Payment Status

Please note that:

  1. While starting an online payment transaction in the G2A PAY Checkout it has a NEW status.
  2. Status PENDING is not notified by IPN (Instant Payment Notification) – payment is in this status immediately after returning from the G2A PAY Checkout.
  3. Every status is notified by an IPN.
  4. Refunds can be triggered manually using the REST API, but the confirmation (status change) will be notified by IPN.

Possible transaction status:

  • PENDING – the payment is being processed through the system (status only applies to some cases, however the system must have notifications prepared for every transaction).
  • COMPLETE – payment completed successfully
  • REJECTED – payment rejection due to security reasons
  • CANCELED – payment cancellation
  • PARTIALLY REFUNDED – partial refund (i.e. one item)
  • REFUNDED – full refund of the payment

Integration credentials

To make the best out of the opportunities that G2A PAY offers you should get a unique API key and a secret token. Then, create an account on https://pay.g2a.com and go to Settings > Merchant.

Each REST API request have to contain an authorization header. An authorization header is a simple HTTP header Authorization with value {API_HASH};{HASH} – where:

  • API_HASH – this is your store API Hash from merchant panel
  • HASH – this value is a string generated using certain parameters applied to the SHA256 checksum algorithm. String contains::
    • API Hash
    • Merchant email (G2A account name)
    • API Secret

Hash calculation example

Variable
Value
API_Hash
485d733d-7937-414a-8d42-6781397b1c0a
API_Secret
pSO_-N%GZDGfpLu!a5qOUnA>T7QqOro?4?z~Lt5u@LKgg>X247PYvZX8gwy~YY=c
Merchant_Email
merchant@my-test-store.com

Hash generation

Result of SHA256 checksum algorithm:

9a67827ae58f013ab22a87c94135d6ce79366cecb79f725f483643b3e2f148ca

HTTP Header

Authorization: 485d733d-7937-414a-8d42-6781397b1c0a;
    9a67827ae58f013ab22a87c94135d6ce79366cecb79f725f483643b3e2f148ca