> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tabby.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Session creation payload model

## Request

The payload example for a session creation request with all required fields for a direct API custom integration. Fields marked `// required` are mandatory for the full checkout session — the <a href="/pay-in-4-custom-integration/checkout-flow#background-pre-scoring-check">background pre-scoring call</a> accepts a minimal subset. Fields marked `// recommended` are optional, but improve scoring accuracy and approval rates — send them whenever you have the data. The `//` comments are annotations, not part of the payload — strip them before sending.

```jsonc theme={"dark"}
{
  "payment": { // required
    "amount": "100", // required. Up to 2 decimals for UAE and KSA, e.g. 100.00
    "currency": "AED", // required. Use the ISO 4217 standard for defining currencies
    "description": "test payload",
    "buyer": { // required
      "name": "John Doe", // required. Customer's full name
      "email": "jsmith@example.com", //required. Customer's email address
      "phone": "500000001", //required. Customer's phone number
      "dob": "2000-01-20"
    },
    "shipping_address": { // required
      "city": "Dubai", // required. Name of city, municipality, or village
      "address": "Dubai", // required. Building name, apartment number
      "zip": "1111" // required. Postal code
    },
    "order": { // required
      "reference_id": "1001", // required. Merchant-assigned order number.
      "updated_at": "2023-11-07T05:31:56Z",
      "tax_amount": "0.00",
      "shipping_amount": "0.00",
      "discount_amount": "0.00",
      "items": [ // required
        {
          "reference_id": "SKU123",
          "title": "Name of the product", // required. Name of the product.
          "description": "Description of the product",
          "quantity": 1, // required. Quantity of the product ordered. Should be >= 1
          "unit_price": "0.00", // required. Price per unit of the product. Should be positive or zero.
          "discount_amount": "0.00",
          "image_url": "https://example.com/",
          "product_url": "https://example.com/",
          "gender": "Kids",
          "category": "Clothes", // required. Name of high-level category (Clothes, Electronics,etc.)
          "color": "white",
          "product_material": "cotton",
          "size_type": "EU",
          "size": "M",
          "brand": "Name of the Brand",
          "is_refundable": true,
          "barcode": "12345678",
          "ppn": "MNXT2ZM/A",
          "seller": "Name of the Seller"
        }
      ]
    },
    "buyer_history": { // required
      "registered_since": "2023-11-07T05:31:56Z", // required. Date and time the customer got registred with you
      "loyalty_level": 0, // recommended. Customer's loyalty level within your store
      "wishlist_count": 0,
      "is_social_networks_connected": true,
      "is_phone_number_verified": true,
      "is_email_verified": true
    },
    "order_history": [ // recommended. 5-10 previous orders
      {
        "purchased_at": "2023-11-07T05:31:56Z", // recommended. Date and time the order was placed
        "amount": "100", // recommended. Up to 2 decimals for UAE and KSA, e.g. 100.00
        "payment_method": "card",
        "status": "new", // recommended. Status of the order
        "buyer": { // recommended
          "name": "John Doe", // recommended. Customer's full name
          "email": "jsmith@example.com", // recommended. Customer's email address
          "phone": "500000001", // recommended. Customer's phone number
          "dob": "2000-01-20"
        },
        "shipping_address": { // recommended
          "city": "Dubai", // recommended. Name of city, municipality, or village
          "address": "Dubai", // recommended. Building name, apartment number
          "zip": "1111" // recommended. Postal code
        },
        "items": [
          {
            "reference_id": "SKU123",
            "title": "Name of the product",
            "description": "Description of the product",
            "quantity": 1,
            "unit_price": "0.00",
            "discount_amount": "0.00",
            "image_url": "https://example.com/",
            "product_url": "https://example.com/",
            "gender": "Kids",
            "category": "Clothes",
            "color": "white",
            "product_material": "cotton",
            "size_type": "EU",
            "size": "M",
            "brand": "Name of the Brand",
            "is_refundable": true,
            "barcode": "12345678",
            "ppn": "MNXT2ZM/A",
            "seller": "Name of the Seller"
          }
        ]
      }
    ],
    "meta": {
      "customer": "#customer-id",
      "order_id": "#1234"
    },
    "attachment": {
      "body": "{\"flight_reservation_details\": {\"pnr\": \"TR9088999\",\"itinerary\": [...],\"insurance\": [...],\"passengers\": [...],\"affiliate_name\": \"some affiliate\"}}",
      "content_type": "application/vnd.tabby.v1+json"
    }
  },
  "lang": "en", // required. Session language
  "merchant_code": "code provided to you from Tabby side", // required. Merchant's branch code
  "merchant_urls": {
    "success": "https://your-store/success",
    "cancel": "https://your-store/cancel",
    "failure": "https://your-store/failure"
  },
  "token": null
}
```

## Response

A successful session creation returns `200 OK` with this structure (the `payment` object echoes your request payload back, trimmed here for brevity):

```jsonc theme={"dark"}
{
  "id": "e5f9d6c8-...",                  // session id
  "status": "created",                    // "created" | "rejected" | "expired"
  "payment": {
    "id": "01a04380-64b8-8432-a20f-904a48584390",  // payment id — SAVE IT: used to verify, capture and refund
    "created_at": "2026-01-20T09:12:00Z",
    "status": "CREATED",
    "is_test": true,
    "amount": "100.00",
    "currency": "AED"
    // ...the rest of your request payload echoed back
  },
  "configuration": {
    "available_products": {
      "installments": [
        {
          "web_url": "https://checkout.tabby.ai/?sessionId=...&apiKey=pk_test_...&product=installments",
          "qr_code": "https://api.tabby.ai/api/v2/checkout/.../hpp_link_qr?product_type=installments"
        }
      ]
    },
    "products": {
      "installments": {
        "type": "installments",
        "is_available": true,
        "rejection_reason": null
      }
    }
  },
  "merchant_urls": {
    "success": "https://your-store/success",
    "cancel": "https://your-store/cancel",
    "failure": "https://your-store/failure"
  },
  "merchant": {
    "name": "Your store name"
  }
}
```

What to read from it:

* **`status`** — `created` means the customer can pay; `rejected` means hide Tabby or show the <a href="/pay-in-4-custom-integration/checkout-flow#possible-rejection_reason-values">rejection message</a>.
* **`payment.id`** — save it; all later calls (<a href="/api-reference/payments/retrieve-a-payment">verify</a>, capture, refund) address the payment by this id.
* **`configuration.available_products.installments[0].web_url`** — the Hosted Payment Page link to redirect the customer to. `installments` is an **array**: take the first element. Always validate `web_url` is present before redirecting.
* On rejection (`status: "rejected"`), the reason is in `configuration.products.installments.rejection_reason` (`null` in `created` responses), and `configuration.available_products` comes back **empty** — no `web_url` to redirect to.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.