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

Refunds

G2A PAY allows to refund payments. A refund request may be full or partial. Partial refunds require that an amount is specified. The currency must match the initial order.

Several partial refund requests may be sent for a single payment transaction. A sum of requested values may not exceed the payment value.

Payment refund example

Authorization

Each request must contain Authorization header:

Authorization: {apiHash}; {authHash}
  • apiHash - It's API Hash of the store
  • authHash - Auth hash can be generated using SHA256 algoritm on string created from parameters:
{apiHash}{email}{apiSecret}

Processing refund

To process a refund for payment, call REST API:

PUT https://pay.g2a.com/rest/transactions/eac61839-7db6-4cab-8ec3-9708c4676938
With header:

Request contain transaction ID to refund, user order ID, amount, currency and hash. Hash is a string generated by hashing some details using SHA256 algorithm:

{transactionId}{userOrderId}{amount}{refundedAmount}{ApiSecret}

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

For more details, see the Notifications section.

Request payload:

action=refund
&amount=100.0
&hash=2a24c939992bc5b2e09480a7cb7acbf2cda32278ecca912457678008ff3a1fdf

Response JSON:

{
"status": "ok",
"transactionId": "eac61839-7db6-4cab-8ec3-9708c4676938"
}

This indicates that the request has been saved by the payment gateway, initiating the refund process. Change of payment status will be confirmed via IPN.

Response status

Below is a list of possible request responses.

HTTP Code
Response
Description
200
{result}
Payment transaction set to refund
400
missing-parameters
Some payment parameters are missing
400
invalid-hash
Invalid hash string
400
invalid-amount
Given amount is to high or less then minimum refund amount
400
invalid-action
Invalid action provided
400
insufficient-funds
Insufficient funds to process refund
401
unauthorized
Authorization header is invalid
403
forbidden
Merchant is not allowed to use this method
403
cannot-refund-transaction
Transaction is in state that is not allowed to refund
404
not-found
Transaction not found
500
error
G2A PAY internal error