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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.dintero.com/feedback

```json
{
  "path": "/docs/checkout/create-session",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Creating a checkout session

> Create a Dintero Checkout payment session with the order amount, currency, items, payment methods, and the return and callback URLs for the customer.

When the customer has added all their items to the cart, and proceeded to the checkout, it's time to create a session in the Dintero system.

A session contains a representation of the order: the amount, currency and items, as well as the configured payment methods, and urls for redirects and callbacks.

## Authentication

To authenticate, you create a [Checkout API client] and use the credentials to
[Create an access token]. The same client can be used for Sandbox mode and production.

For all requests to the API set the following header:

```
Authorization: Bearer {access_token}
```

[Checkout API client]: /docs/checkout/checkout-client

[Create an access token]: /docs/checkout/authentication

## Create session request

The session is created with an HTTP POST-request to `https://checkout.dintero.com/v1/sessions-profile`.

Set `Content-Type: application/json` and the authorization header.

> Most new accounts should have the `default` profile\_id available. If you have an old account, go [here](/docs/checkout/payment-profiles) to learn how to create one.

```json theme={null}
{
  "url": {
    "return_url": "https://example.com/thankyou",
    "callback_url": "https://example.com/callback"
  },
  "order": {
    "amount": 33890,
    "currency": "NOK",
    "merchant_reference": "merchants_order_number",
    "items": [
      {
        "id": "chair-1",
        "line_id": "1",
        "description": "Stablestol",
        "quantity": 1,
        "amount": 29990,
        "vat_amount": 6000,
        "vat": 25
      }
    ],
    "shipping_option": {
      "id": "local-pick-up-point",
      "line_id": "local-pick-up-point",
      "amount": 3900,
      "operator": "",
      "title": "Pick up at a pick-up point",
      "delivery_method": "pick_up"
    }
  },
  "express": {
    "shipping_options": [],
    "shipping_address_callback_url": "https://example.com/shipping_address_changed"
  },
  "profile_id": "default"
}
```

<Info>
  Amounts are denoted in the smallest unit for the currency, for example cents.

  * 299.90 NOK becomes 29990
  * 299 NOK becomes 29900
</Info>

To learn more about the fields, check out the complete documentation for the [create session]-endpoint.

Once the session is created, you can proceed with showing the checkout to the customer.

### Example response

By default the response looks like this, but see the the complete documentation for the [create session]-endpoint for more details and options.

```json theme={null}
{
  "id": "{session_id}",
  "url": "https://checkout.api.dintero.com/v1/view/{session_id}/"
}
```

[Checkout API client]: /docs/checkout/checkout-client

[create session]: /payments-api.html#operation/checkout_session_profile_post
