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 thecampaignslist of the current pre-order state.
Validation:
campaignmust match a code from the availablecampaignslist. If the submitted code is not found in the list, a validation error is returned and the user remains onCampaignSelectionPage.
State Update:
On success,
selected_campaignin the pre-order is set to the submitted campaign code.
Backward Navigation:
When navigating backward from this page,
selected_campaignis reset tonull, 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.
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>)
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.
CAMP001Campaign selected successfully
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'"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?

