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

Select a campaign to apply to the order

Submits the user's chosen campaign code. The submitted code is validated against the list of campaigns previously fetched from the payment gateway. On success, the selected campaign is stored in the pre-order state.

Required Fields:

  • campaign: The code of the campaign to apply. Must be one of the codes present in the campaigns list of the current pre-order state.

Validation:

  • campaign must match a code from the available campaigns list. If the submitted code is not found in the list, a validation error is returned and the user remains on CampaignSelectionPage.

State Update:

  • On success, selected_campaign in the pre-order is set to the submitted campaign code.

Backward Navigation:

  • When navigating backward from this page, selected_campaign is reset to null, requiring the user to re-select a campaign.

Next Pages:

  • The checkout flow advances to the next applicable step as determined by the overall checkout state.

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
campaignstringRequired

The code of the campaign to apply to the order. Must match one of the campaign codes present in the campaigns list of the current pre-order state. Submitting a code not present in that list causes a validation error.

Example: CAMP001
Responses
200

Campaign selected successfully

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

"campaign='CAMP001'"
200

Campaign selected successfully

{
  "context_list": [
    {
      "page_name": "CampaignSelectionPage",
      "page_slug": "campaignselectionpage",
      "page_context": {
        "campaigns": [
          {
            "code": "CAMP001",
            "name": "3 Installments Campaign"
          },
          {
            "code": "CAMP002",
            "name": "6 Installments Campaign"
          }
        ]
      }
    }
  ],
  "pre_order": {
    "user_email": "user@akinon.com",
    "payment_option": {
      "pk": 3,
      "name": "Credit Card",
      "slug": "credit-card",
      "payment_type": "credit_card",
      "payment_type_label": "Credit Card"
    },
    "campaigns": [
      {
        "code": "CAMP001",
        "name": "3 Installments Campaign"
      },
      {
        "code": "CAMP002",
        "name": "6 Installments Campaign"
      }
    ],
    "selected_campaign": "CAMP001"
  },
  "errors": {},
  "template_name": "orders/checkout.html"
}

Last updated

Was this helpful?