Process GPay Payment Callback
Processes the callback returned by the Garanti Pay gateway after the customer completes the payment on the provider's hosted form.
The gateway posts its result to this endpoint. Query parameters present on the incoming callback URL are automatically merged with the POST body before validation, so fields returned via redirect query string are handled transparently alongside form-encoded fields.
The submitted payload is verified server-side using a gateway-specific HMAC hash. The gpinstallment value is resolved against the card's active instalment records and stored on the pre-order before order finalisation.
Preconditions:
A payment option with
payment_type: gpaymust be selected on the pre-orderA transaction identifier must be present on the pre-order
Processing Flow:
Merges GET query parameters from the callback URL into the submitted data
Validates
gpay: trueandsuccess: trueflags from the gatewayResolves
gpinstallmentagainst the active instalment options for the pre-order's card and stores the resolved instalment on the pre-orderVerifies the full payload against the gateway's HMAC hash to confirm authenticity
Creates a return transaction record (
transaction_type: return_back) with the payment outcome; the transaction identifier follows the formatGPAY_{order_number}_{suffix}On success: finalises the order, submits the basket, sends order confirmation email and SMS notifications, then advances to
ThankYouPageOn failure: performs a full rollback — clears
transaction_idand the redirect state, resets the order number, and setscard_infotonull, returning the pre-order to the state it held atGPaySelectionPage
No dynamic settings apply to this page. All behaviour is determined by the static configuration of the Garanti Pay gateway.
Required header for AJAX requests. Must be set to XMLHttpRequest for all checkout requests.
XMLHttpRequestPossible values: Session cookie header (e.g. sessionid=abc123 or osessionid=<session_id>)
Callback payload posted by the Garanti Pay gateway after the customer
completes the payment on the provider's hosted form.
All three fields are required. gpay and success must both be true
for the payment to be accepted. gpinstallment carries the instalment
count selected by the customer on the Garanti Pay form and is resolved
against the active instalment options for the pre-order's card.
The full payload (including any additional fields returned by the gateway)
is also verified against a gateway-specific HMAC hash. Payloads that fail
hash verification are rejected regardless of the gpay and success
values.
Garanti Pay authorisation flag returned by the gateway. Must be true; any other value is treated as a failed transaction.
Payment success flag returned by the gateway. Must be true; any other value is treated as a failed transaction.
Instalment count selected by the customer on the Garanti Pay hosted form (e.g. "1" for a single payment, "3" for three instalments). The value is resolved against the active instalment records for the pre-order's card. If no matching active instalment is found the resolved instalment on the pre-order is set to null.
3GPay callback processed. On success the order is finalised and the flow advances to ThankYouPage. On failure a full rollback is performed and a validation error is returned so the customer may retry from the payment selection step.
Redirect to basket (empty basket) or login (guest purchase not allowed)
POST /orders/checkout/?page=GPayCompletePage HTTP/1.1
Host: sandbox.akinon.com
x-requested-with: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 48
"gpay=true&success=true&gpinstallment='3'"{
"context_list": [
{
"page_name": "ThankYouPage",
"page_slug": "thankyoupage",
"page_context": {
"order_number": "ORD-20240101-00003",
"redirect_url": "",
"new_user": false
}
}
],
"pre_order": {
"number": "ORD-20240101-00003",
"payment_option": {
"pk": 12,
"name": "Garanti Pay",
"slug": "garanti-pay",
"payment_type": "gpay"
},
"total_amount": "249.90",
"installment": {
"pk": 7,
"installment_count": 3,
"label": "3 Installments"
},
"is_guest": false,
"is_post_order": false
},
"errors": null,
"template_name": ""
}Last updated
Was this helpful?

