For the complete documentation index, see llms.txt. This page is also available as Markdown.

Initiate GPay Redirect Transaction

Initiates the Garanti Pay redirect flow by creating a redirect-type transaction record and storing the resulting transaction identifier in the checkout session. After successful submission, the flow advances to GPayCompletePage, which supplies the external redirect URL to the Garanti Pay hosted payment page.

Request Body:

  • No input fields are required. The request body must be empty. Submit the POST with no body, or pass an empty form-encoded payload {}.

Processing Flow:

  1. The client IP address is captured from the incoming request and stored in the checkout session for transaction logging and fraud prevention.

  2. A redirect-type transaction record is persisted with the following attributes:

    • Transaction identifier: REDIRECT_GPAY_{order_number}

    • Transaction type: redirect

    • Succeeded flag: true

    • 3D Secure flag: false

    • Amount: the order total inclusive of any applicable installment interest

    • Currency: taken from the checkout session currency

  3. The persisted transaction identifier is written into the checkout session state, marking this step as complete and enabling the is_already_done check on subsequent GET requests.

Backward Navigation:

  • When the user navigates back from this step, the stored redirect transaction identifier and any redirect-state marker are removed from the checkout session, reverting the flow to the GPay Selection step.

Next Page:

  • GPayCompletePage — Provides the redirect URL and processes the Garanti Pay callback once the user returns from the external hosted payment page.

Error Handling:

  • If the POS configuration is missing or invalid, transaction creation fails and an error is returned. The checkout session is not modified on failure.

post
Header parameters
x-requested-withstring · enumRequired

Required header for AJAX requests. Must be set to XMLHttpRequest for all checkout requests.

Default: XMLHttpRequestPossible values:
CookiestringOptional

Session cookie header (e.g. sessionid=abc123 or osessionid=<session_id>)

Body
object · GPayRedirectPageInputOptional

No input fields are required for this step. The request body must be empty. Any fields submitted in the body are not processed by this page and will not cause a validation error; however, the Garanti Pay gateway is not involved at this step, so gateway-specific parameters are irrelevant here.

Responses
200

Redirect transaction initiated — flow advancing to GPayCompletePage

application/json
errorsone of · nullableOptional
or
string[]Optional
template_namestringOptional
post/orders/checkout/?page=GPayRedirectPage
POST /orders/checkout/?page=GPayRedirectPage HTTP/1.1
Host: sandbox.akinon.com
x-requested-with: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 2

""
200

Redirect transaction initiated — flow advancing to GPayCompletePage

{
  "context_list": [
    {
      "page_name": "GPayCompletePage",
      "page_slug": "gpaycompletepage",
      "page_context": {
        "redirect_url": "/orders/gpay-redirect/"
      }
    }
  ],
  "pre_order": {
    "basket": {
      "pk": 123,
      "total_amount": "250.00"
    },
    "payment_option": {
      "pk": 5,
      "name": "GPay",
      "slug": "gpay",
      "payment_type": "gpay",
      "payment_type_label": "GPay"
    },
    "card_info": {
      "bin_number": "GPAY00",
      "card": {
        "pk": 3,
        "name": "Garanti Pay Virtual Card"
      }
    },
    "number": "1097695957912771",
    "total_amount": "250.00",
    "total_amount_with_interest": "250.00",
    "unpaid_amount": "250.00",
    "currency_type_label": "TRY"
  },
  "errors": null,
  "template_name": ""
}

Last updated

Was this helpful?