# Independent Pages

This document covers all services for independent pages, including the requests and responses associated with these services.

{% hint style="warning" %}
**Authenticated Endpoints**

Accessing authenticated endpoints requires users to establish a session through Session Authentication. To do this:

1. Users must log in using their credentials (e.g., username and password) via a designated authentication endpoint.
2. Upon successful login, the server will generate and return a session cookie to the client.
3. This session cookie must be included in subsequent API requests as part of the headers. The session cookie serves as proof of authentication and ensures secure access to protected resources.
   {% endhint %}

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Order Note Page</mark>

This page is used to add or remove notes for orders.

**Path:** `https://{commerce_url}/orders/checkout/?page=OrderNotePage`

### <mark style="color:red;">Add a Note to the Order</mark>

To add a note to the order, the `notes` field must be included in the request payload. This field should contain the specific note you want to attach to the order.

**Example Request**

In order to add notes to the order, the "notes" field needs to be included in the request. This field should contain the specific note that user want to add to the order.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=OrderNotePage"

payload = 'notes=my%20order%20note%20is...'
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

The notes are added to the `pre_order` field in the response that is returned after the request is sent.

```json
{
  "context_list": [],
  "template_name": "orders/checkout.html",
  "errors": null,
  "pre_order": {
    "notes": "my order note is...",
    // ... other fields ...
    "has_remote_price": false
  }
}
```

### <mark style="color:red;">Remove a Note from the Order</mark>

To remove an existing note, send the `notes` field **with an empty value** (`notes=`). This action removes the `notes` key from the `pre_order` object in the response.

**Example Request:**

```python
import requests

url = "https://{commerce_url}/orders/checkout/?page=OrderNotePage"

payload = 'notes='
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response:**

```json
{
  "context_list": [],
  "template_name": "orders/checkout.html",
  "errors": null,
  "pre_order": {
    // ... other fields ...
    "has_remote_price": false
    // "notes" field has been removed
  }
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Gift Box Index Page</mark>

This page is called before the Gift Box Page to check the validity of the settings. After performing the necessary checks, it recommends the Gift Box Page as the next page.

**Path:** `https://{commerce_url}/orders/checkout/?page=GiftBoxIndexPage`

**Example Request**

There is no need to include any data in the request. Simply submit an empty request.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=GiftBoxIndexPage"

payload = {}
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

In the context list, the next step is returned as the GiftBoxPage.

```json
{
    "context_list": [
        {
            "page_context": {
                "price": "10.90"
            },
            "page_name": "GiftBoxPage",
            "page_slug": "giftboxpage"
        }
    ],
    "template_name": "orders/checkout.html",
    "errors": null,
    "pre_order": {}
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Gift Box Page</mark>

The gift box field is added to the preorder, and it specifies whether there are options available to add to the gift box.

**Path:** `https://{commerce_url}/orders/checkout/?page=GiftBoxPage`

**Example Request**

Fields such as `note`, `gift_video`, and `gift_video_notification_sent` are included in the request to determine the specifications of the gift box.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=GiftBoxPage"

payload = 'note=it\'s%20my%20note&gift_video=false&gift_video_notification_sent=false'
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

The sent fields (`note`, `gift_video`, `gift_video_notification_sent`) are added to the `gift_box` field in the pre\_order.

```json
{
    "context_list": [],
    "template_name": "orders/checkout.html",
    "errors": null,
    "pre_order": {
        "gift_box": {
            "note": "it's my note.",
            "gift_video": false,
            "gift_video_notification_sent": false,
            "price": "10.90"
        }
	}
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Delivery Bags Page</mark>

The delivery bags products are calculated and added to the preorder.

**Path:** `https://{commerce_url}/orders/checkout/?page=DeliveryBagsPage`

**Example Request**

To perform the operation for a specific product, it is necessary to include the product SKU field in the request. This allows for identification of the product for which the operation will be performed.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=DeliveryBagsPage"

payload = 'product=product.sku'
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

The `bags_fee` and `bags` information are returned in the `pre_order`.

```json

{
    "context_list": [],
    "template_name": "orders/checkout.html",
    "errors": null,
    "pre_order": {
			"bags_fee": ""
			"bags":  [
				{
				"pk":  3803,
				"name":  "Antoınette Tatlı Bıçağı",
				"sku":  "1KBICK0009",
				"base_code":  "1KBICK0009",
				"attributes":  {
				},
				"attribute_set":  7,
				"attributes_kwargs":  {},
				"extra_attributes":  {},
				"productimage_set":  [],
				"price":  "10.90",
				"in_stock":  false,
				"currency_type":  "try",
				"retail_price":  "27.25",
				"unit_type":  null,
				"absolute_url":  "/product/3803/",
				"productvideo_set":  [],
				"product_type":  "1",
				"price_type":  "default",
				"form_schema":  null,
				"is_ready_to_basket":  false,
				"stock":  null,
				"data_source":  null
				},
			]
     }
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Reward List Page</mark>

Queries the available rewards can be used by retrieving the credit card information.

**Path:** `https://{commerce_url}/orders/checkout/?page=RewardListPage`

**Example Request**

To list the rewards, provide the card information (`card_number`, `card_year`, `card_month`, `card_cvv`).

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=RewardListPage"

payload = 'card_number=03948590328570&card_year=30&card_month=03&card_cvv=234'
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

The reward information that is compatible with the provided card information is returned in the `page_context`, and the next page will be the `RewardSelectionPage` where points can be selected.

```json
{
	"context_list":[
	{
		"page_context":{
		"rewards":[
			{
			"amount":"1234.00",
			"type":"general"
			}
		]
	},
		"page_name":"RewardSelectionPage",
		"page_slug":"rewardselectionpage"
	}
	],
	"template_name":"orders/checkout.html",
	"errors":null,
	"pre_order":{
		"rewards": []
	 }
  }
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Reward Selection Page</mark>

When a POST request is sent to this page, the card and bank compatible rewards are used.

**Path:** `https://{commerce_url}/orders/checkout/?page=RewardSelectionPage`

**Example Request**

There is no need to include any data in the request. Simply submit an empty request.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=RewardSelectionPage"

payload = {}
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

The reward to be used is selected and added to the `selected_rewards` and `pre_order` fields.

```json
{
	"context_list": [],
	"template_name": "orders/checkout.html",
	"errors": null,
	"pre_order": {
		"selected_rewards": "",
	}
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Coupon Selection Page</mark>

This method is used to add or remove coupons from the pre-order.

**Path:** `https://{commerce_url}/orders/checkout/?page=CouponSelectionPage`

**Example Request**

To add or remove coupons from the pre-order, users need to specify the coupon name and the action to be applied. For example, to add a coupon named "A", user would use the action of adding. Similarly, to remove a coupon named "B", you would use the action of removing.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=CouponSelectionPage"

payload = 'coupon=coupon-name&action=add'
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

Following the applied process, the list of coupons is added to the `pre_order`, and the coupons are checked from this list.

```json
{
	"context_list": [],
	"template_name": "orders/checkout.html",
	"errors": null,
	"pre_order": {
		"coupons": ["coupon-name"]
	}
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Order Selection Page</mark>

By adding an extra\_field in the order, users can utilize its benefits.

**Path:** `https://{commerce_url}/orders/checkout/?page=OrderSelectionPage`

**Example Request**

The schema and other relevant details (`data_type`, `key`, etc.) must be sent in the extra\_field.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=OrderSelectionPage"

payload = 'extra_field=%7B%22key%22%3A%20%22extra_field%22%2C%20%22label%22%3A%20%22Extra%20Field%22%2C%20%22data_type%22%3A%20%22nested%22%2C%20%22schema%22%3A%20%7B%22foo%22%3A%20%7B%22key%22%3A%20%22foo%22%2C%20%22label%22%3A%20%22Foo%22%2C%20%22required%22%3A%20true%2C%20%22data_type%22%3A%20%22text%22%7D%7D%7D'
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

The provided information is added to the `pre_order` along with the specified `extra_field` name.

```json
{
	"context_list": [],
	"template_name": "orders/checkout.html",
	"errors": null,
	"pre_order": {
		"extra_field" :'{ "key": "extra_field", "label": "Extra Field", "data_type": "nested", "schema": { "foo": { \n"key": "foo", "label": "Foo", "required": True, "data_type": "text" } } }\n'
	}
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Campaign List Page</mark>

Queries the campaigns suitable for credit cards.

**Path:** `https://{commerce_url}/orders/checkout/?page=CampaignListPage`

**Example Request**

To list the campaigns that are suitable for a specific credit card, `card_number` must be sent in the request.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=CampaignListPage"

payload = 'card_number=03948590328570'
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

Inside the `page_context`, a list of campaigns is returned, and the next page targeted is the CampaignSelectionPage.

```json
{
"context_list": [
	{
	"page_context": {
		"campaigns": []
	}
	"page_name": "CampaignSelectionPage",
	"page_slug": "campaignselectionpage"
	}
],
	"template_name": "orders/checkout.html",
	"errors": null,
	"pre_order": {}
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Campaign Selection Page</mark>

This page adds the selected campaign to the preorder.

**Path:** `https://{commerce_url}/orders/checkout/?page=CampaignSelectionPage`

**Example Request**

One of the rotating campaigns from the `CampaignListPage` should be selected and included in the request.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=CampaignSelectionPage"

payload = 'campaign='
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

In the response, the campaign that was sent in the request as the `selected_campaign` is added to the `pre_order`.

```json
{
"context_list": []
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {
		"selected_campaign": ""
	}
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Address Clear Page</mark>

Clears the address information written on the preorder.

**Path:** `https://{commerce_url}/orders/checkout/?page=AddressClearPage`

**Example Request**

There is no need to include any data in the request. Simply submit an empty request.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=AddressClearPage"

payload = {}
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

The address information in the `pre_order` is cleared, and the next page directed is the `AddressSelectionPage`.

```json
{
	"context_list": [
		"page_context": {
			"addresses": [],
			"country": {}
		}
		"page_name": "AddressSelectionPage",
		"page_slug": "addressselectionpage"
	]
	"template_name": "orders/checkout.html",
	"errors": null,
	"pre_order": {
			...
		}
	}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Checkout Provider Index Page</mark>

The list of providers that can be used is returned.

**Path:** `https://{commerce_url}/orders/checkout/?page=CheckoutProviderIndexPage`

**Example Request**

There is no need to include any data in the request. Simply submit an empty request.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=CheckoutProviderIndexPage"

payload = {}
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

The list of `checkout_providers` is returned in the `page_context`, and the `CheckoutProviderSelectionPage` is called to enable the selection of a checkout from this list.

```json
{
    "context_list": [
        {
            "page_context": {
                "checkout_providers": [
                    {
                        "pk": 1,
                        "name": "Akifast",
                        "slug": "akifast"
                    }
                ]
            },
            "page_name": "CheckoutProviderSelectionPage",
            "page_slug": "checkoutproviderselectionpage"
        }
    ],
    "template_name": "orders/checkout.html",
    "errors": null,
    "pre_order": {
      "checkout_provider_process_started": True
    }
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Checkout Provider Selection Page</mark>

The customer is given the option to choose which checkout provider to use on this page.

**Path:** `https://{commerce_url}/orders/checkout/?page=CheckoutProviderSelectionPage`

**Example Request**

The ID of one of the providers returned for the `CheckoutProviderIndexPage` is selected and included in the request with the `checkout_provider` field.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=CheckoutProviderSelectionPage"

payload = 'checkout_provider=provider.id'
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

The `redirect_url` is returned in the `page_context`, and this URL is saved in the `pre_order` as `remote_redirect_url`.

```json
{
    "context_list": [
        {
            "page_context": {
                "redirect_url": "https://sandbox.akifast.com/api/v1/hpp?session_token=10dedd46-9f3d-4273-8220-d0f51975ca1c&transaction_token=uDV2wuZCBKOxvbBPSGyS%2F8qPbRZgyVcuDLVGU43%2B3vYrS7kXzlkkakdKTMrZ2VpWwPpIO0oHlEeQkIbZWw7I3g%3D%3D"
            },
            "page_name": "CheckoutProviderAddressSelectionPage",
            "page_slug": "checkoutprovideraddressselectionpage"
        }
    ],
    "template_name": "orders/checkout.html",
    "errors": null,
    "pre_order": {
        "remote_redirect_url": "https://sandbox.akifast.com/api/v1/hpp?session_token=10dedd46-9f3d-4273-8220-d0f51975ca1c&transaction_token=uDV2wuZCBKOxvbBPSGyS%2F8qPbRZgyVcuDLVGU43%2B3vYrS7kXzlkkakdKTMrZ2VpWwPpIO0oHlEeQkIbZWw7I3g%3D%3D",
    }
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Checkout Provider Address Selection Page</mark>

This is the page where the user selects the address in Akifast.

**Path:** `https://{commerce_url}/orders/checkout/?page=CheckoutProviderAddressSelectionPage`

**Example Request**

The `billing_address`, `shipping_address`, `session_token`, and `basket_id` fields should be sent based on the selected address.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=CheckoutProviderAddressSelectionPage"

payload = 'billing_address=%7B...%7D&shipping_address=%7B...%7D&session_token=token&basket_id=basket.id'
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

A new redirect\_url is returned in the page\_context as the response.

```json
{
	"context_list": [
	"page_slug": "checkoutprovideraddressselectionpage",
	"page_name": "CheckoutProviderAddressSelectionPage",
	"page_context": {
		   "redirect_url": "",
		}
	]
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Checkout Provider Shipping Option Page</mark>

The available shipping companies are listed when the user selects an address in Akifast.

**Path:** `https://{commerce_url}/orders/checkout/?page=CheckoutProviderShippingOptionPage`

**Example Request**

The request should include the `basket_id`, `conversation_id`, and `language` fields in order to list the available shipping companies.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=CheckoutProviderShippingOptionPage"

payload = 'basket_id=basket.id&conversation_id=conversation.id&language='
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

The `shipping_options` response is returned with the `shipping_options` list in the `page_context`.

```json

{ 
"context_list": [ 
	{ "page_context": 
		{ 
		    "shipping_options": {
					...
			}, 
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Checkout Provider Agreement List Page</mark>

The page displays contract titles.

**Path:** `https://{commerce_url}/orders/checkout/?page=CheckoutProviderAgreementListPage`

**Example Request**

The previously sent information (`basket_id`, `session_token`, `shipping_option_key`, `shipping_address`, `billing_address`) needs to be sent again on this page. Additionally, include the fields `code` and `user` in this information.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=CheckoutProviderAgreementListPage"

payload = 'billing_address=%7B...%7D&shipping_address=%7B...%7D&session_token=token&basket_id=basket.id&shipping_option_key=shipping.pk&user=%7B...%7D&code='
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

In the response, the `agreements` field is returned within the `page_context`.

```json
{
	"context_list": [ 
		{ "page_context": 
			{ 
			  "agreements": {
					...
				}
			}
			}
		]
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;">**Checkout Provider Notification Page**</mark>

The page is sent to the shop side for order creation after the payment is received on the Akifast side. The request includes all the necessary information for order creation.

**Path:** `https://{commerce_url}/orders/checkout/?page=CheckoutProviderNotificationPage`

**Example Request**

To complete a post-negotiation transaction, send the following fields in the request: `agreements`, `conversation_id`, `payment_info`, `transaction`, `card_info`, `shipping_address`, `akifast_user`, and `is_successful`.

```json
{
	"agreements": True,
	"conversation_id": "",
	"payment_info": {},
	"transaction": {},
	"card_info": {},
	"shipping_address": {},
	"billing_address": {},
	"akifast_user": {},
	"is_successful": True
}
```

**Example Response**

After sending the required information, the `page_context` returns the following fields: `code`, `text`, and `agreement_body`.

```json
{
   "context_list": [ 
	{ "page_context": 
		{ 
		  "code": "",
		  "text": "",
		  "agreement_body": ""
		}
		}]
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Checkout Provider Thank You Page</mark>

After the order is created, a `return_url` is generated within the Akifast application. This URL serves as a dynamic address for the thank you page, indicating that your order has been successfully approved.

**Path:** `https://{commerce_url}/orders/checkout/?page=CheckoutProviderThankYouPage`

**Example Request**

There is no need to include any data in the request. Simply submit an empty request.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=CheckoutProviderThankYouPage"

payload = {}
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

The `page_context` returns the `return_url`, and the user is redirected to that URL.

```json

{ 
"context_list": [ 
	{ "page_context": 
		{ 
		    "return_url": "https://...", 
}
```

## <mark style="color:red;">`GET`</mark> <mark style="color:red;"></mark><mark style="color:red;">Thank You Page</mark>

The thank you page is shown to the user after the order is completed.

**Path:** `https://{commerce_url}/orders/checkout/?page=ThankYouPage`

**Example Request**

There is no need to include any data in the request. Simply submit an empty request.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=ThankYouPage"

payload = {}
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

In the response, a `redirect_url` is returned which redirects the user to the `ThankYouPage`.

```json
{ 
	"context_list": [ 
		{ 
			"page_context": 
				{ 
				    "redirect_url": "https://{commerce_url}/completed/{ORDERNUMBER}", 
				    "order_id": 123,
					"order_number": "ON123",
				    "new_user": false,
				    "token": "df8a210c-c19d-4497-ad63-494fdea1f1e0", 
				    "campaigns": 
				    [ { "code": "1", "message": "xyz" }, ], }, } ], 
				    "template_name": 
				    "orders/checkout.html", 
				    "errors": null, 
				    "pre_order": {...} 
				}
		}
	]
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Redirect Guard Page</mark>

This page provides a control to ensure successful redirection and prevent further redirection.

**Path:** `https://{commerce_url}/orders/checkout/?page=RedirectGuardPage`

**Example Request**

There is no need to include any data in the request. Simply submit an empty request.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=RedirectGuardPage"

payload = {}
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

No additional data is returned in the response.

```json
{}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Loyalty Card Page</mark>

This page is used to set loyalty point amount.

**Path:** `https://{commerce_url}/orders/checkout/?page=LoyaltyCardPage`

**Example Request**

Include the `selected_loyalty_amount` field in the request to indicate the chosen amount.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=LoyaltyCardPage"

payload = 'selected_loyalty_amount=100.00'
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

Upon sending the request, the response include fields such as `loyalty_total_amount`, `loyalty_amount`, `card_number`, `applied_amount`, and `loyalty_points_type`. These fields provide detailed information about the transaction. If the operation is unsuccessful, these fields are returned blank.

```json
{
	"loyalty_total_amount": "100.00",
	"loyalty_amount": "100.00",
	"card_number": "5555555555554444",
	"applied_amount": "100.00",
	"loyalty_points_type": "points_type"
}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Send Barcode SMS Page</mark>

This page is used to send barcode SMS to the phone number provided.

**Path:** `https://{commerce_url}/orders/checkout/?page=SendBarcodeSmsPage`

**Example Request**

Include the phone number to which the message is requested in the request.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=SendBarcodeSmsPage"

payload = 'phone_number=5XXXXXXXXX'
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

No additional data is returned in the response.

```json
{}
```

## <mark style="color:red;">`POST`</mark> <mark style="color:red;"></mark><mark style="color:red;">Send Checkout URL SMS Page</mark>

If a customer does not have a QR reader app and cannot scan the barcode, the checkout URL is sent to them via SMS.

**Path:** `https://{commerce_url}/orders/checkout/?page=SendCheckoutUrlSmsPage`

**Example Request**

Include the phone number to which the message is requested in the request.

```py
import requests

url = "https://{commerce_url}/orders/checkout/?page=SendCheckoutUrlSmsPage"

payload = 'phone_number=5XXXXXXXXX'
headers = {
  'x-requested-with': 'XMLHttpRequest',
  'Cookie': 'osessionid=<session_id>',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

**Example Response**

No additional data is returned in the response.

```json
{}
```
