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.
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.
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 ¤cy=EUR &status=complete &orderCreatedAt=2015-02-20 01:21:35 &orderCompleteAt=2015-02-20 01:25:51 &refundedAmount=0 &provisionAmount=0 &hash=2a24c939992bc5b2e09480a7cb7acbf2cda32278ecca912457678008ff3a1fdf
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:
String to hash: