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

Notifications

G2A PAY sends simple notifications after every payment status change– this is called IPN (Instant Payment Notification). Merchants can use IPN to automate fulfilling orders and providing customers with order status.

How to use IPN?

To be able to receive these IPNs, first you have to set up an appropriate IPN listener page URL where messages will be forwarded. To do this, enter https://pay.g2a.com and navigate to Settings > Merchant. G2A PAY then sends notifications of all transaction-related events to that URL.

Notifications

IPN example

IPNs are sent in as RAW POST body. Below is a sample IPN with a confirmation that the transaction has been finished:

type=payment
&transactionId=eac61839-7db6-4cab-8ec3-9708c4676938
&userOrderId=70001010467320
&amount=100.0
&currency=EUR
&status=complete
&orderCreatedAt=2015-02-20 01:21:35
&orderCompleteAt=2015-02-20 01:25:51
&refundedAmount=0
&provisionAmount=0
&hash=2a24c939992bc5b2e09480a7cb7acbf2cda32278ecca912457678008ff3a1fdf

IPN Hash

Each IPN has hash field which is calculated from transaction data. For security reasons this hash should always be checked in merchant application. The simplest way to confirm that the IPN is valid is to generate hash from data stored in the merchant database and compare with the one received in the IPN.

Hash is a string generated by hashing some transaction details using SHA256 algorithm:

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

Amount example

Original amount
Rounded amount
2
2
2.2
2.2
2.21
2.21
2.234
2.23
2.235
2.24

Hash example

Field
Value
transactionId
ff4dce11-6064-4401-a621-86226aa5e599
userOrderId
985711
amount
20.51
ApiSecret
9pcrHX4irvG5=@$>qF-pUYnoR>@VJ?~SoR4!z8Zb+pgqgZpHoa!2$eqKdhpwfe9E<

String to hash:

ff4dce11-6064-4401-a621-86226aa5e59998571120.519pcrHX4irvG5=@$>qF-pUYnoR>@VJ?~SoR4!z8Zb+pgqgZpHoa!2$eqKdhpwfe9E

Hash:

1abadc9696537644b77274e953e145ec5b017b3257ff23d003c0b54c7ddbda98