> ## 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/quickstart",
  "feedback": "Description of the issue"
}
```

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

</AgentInstructions>

# Quickstart

> Go from zero to your first Dintero Checkout payment in minutes. Create credentials, authenticate, build a checkout session, and handle the payment result.

This guide walks you through the complete flow: create credentials, authenticate, create a checkout session, and handle the payment result.

## Prerequisites

* A Dintero account ([sign up here](https://onboarding.dintero.com/))
* Access to [Dintero Backoffice](https://backoffice.dintero.com/)
* A server that can make HTTP requests

## Test vs production

Every Dintero account has two environments, identified by the account ID prefix:

| Prefix | Environment | Example     | Purpose                                                                     |
| ------ | ----------- | ----------- | --------------------------------------------------------------------------- |
| `T`    | Test        | `T12345678` | Sandbox — no real money, use [test cards](/docs/checkout/checkout-testdata) |
| `P`    | Production  | `P12345678` | Live — real payments                                                        |

<Info>
  Start with your test account (`T` prefix). Switch to production by creating new API credentials on your `P` account when you're ready to go live.
</Info>

## Step 1: Create API credentials

<Steps>
  <Step title="Open Backoffice">
    Go to **Settings** > **API clients** (under API & Integrations).
  </Step>

  <Step title="Create a client">
    Click **Create new API client** > **Checkout client**, enter your website URL, and click **Create**.
  </Step>

  <Step title="Save credentials">
    Copy the **Client ID** and **Client Secret** immediately.
  </Step>
</Steps>

<Warning>
  The Client Secret is shown only once. Store it securely — you cannot retrieve it later.
</Warning>

For a visual walkthrough, see the [API Client](/docs/checkout/checkout-client) page.

## Step 2: Get an access token

Exchange your credentials for a bearer token using the OAuth 2.0 client credentials flow.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.dintero.com/v1/accounts/T12345678/auth/token \
    -u "CLIENT_ID:CLIENT_SECRET" \
    -H "Content-Type: application/json" \
    -d '{
      "grant_type": "client_credentials",
      "audience": "https://api.dintero.com/v1/accounts/T12345678"
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.dintero.com/v1/accounts/T12345678/auth/token",
      auth=("CLIENT_ID", "CLIENT_SECRET"),
      headers={"Content-Type": "application/json"},
      json={
          "grant_type": "client_credentials",
          "audience": "https://api.dintero.com/v1/accounts/T12345678",
      },
  )
  access_token = response.json()["access_token"]
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://api.dintero.com/v1/accounts/T12345678/auth/token",
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        Authorization:
          "Basic " + Buffer.from("CLIENT_ID:CLIENT_SECRET").toString("base64"),
      },
      body: JSON.stringify({
        grant_type: "client_credentials",
        audience: "https://api.dintero.com/v1/accounts/T12345678",
      }),
    }
  );
  const { access_token } = await response.json();
  ```
</CodeGroup>

The response includes a token valid for 4 hours:

```json theme={null}
{
  "access_token": "eyJhbGci...t7P4",
  "token_type": "Bearer",
  "expires_in": 14400
}
```

Use this token in the `Authorization: Bearer {access_token}` header for all API calls.

## Step 3: Create a checkout session

A session represents a customer's order. Send the order details and get back a checkout URL.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://checkout.dintero.com/v1/sessions-profile \
    -H "Authorization: Bearer ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "url": {
        "return_url": "https://example.com/thankyou",
        "callback_url": "https://example.com/callback"
      },
      "order": {
        "amount": 29990,
        "currency": "NOK",
        "merchant_reference": "order-001",
        "items": [
          {
            "id": "item-1",
            "line_id": "1",
            "description": "Blue T-Shirt",
            "quantity": 1,
            "amount": 29990,
            "vat_amount": 5998,
            "vat": 25
          }
        ]
      },
      "profile_id": "default"
    }'
  ```

  ```python Python theme={null}
  response = requests.post(
      "https://checkout.dintero.com/v1/sessions-profile",
      headers={"Authorization": "Bearer ACCESS_TOKEN"},
      json={
          "url": {
              "return_url": "https://example.com/thankyou",
              "callback_url": "https://example.com/callback",
          },
          "order": {
              "amount": 29990,  # 299.90 NOK
              "currency": "NOK",
              "merchant_reference": "order-001",
              "items": [
                  {
                      "id": "item-1",
                      "line_id": "1",
                      "description": "Blue T-Shirt",
                      "quantity": 1,
                      "amount": 29990,
                      "vat_amount": 5998,
                      "vat": 25,
                  }
              ],
          },
          "profile_id": "default",
      },
  )
  session = response.json()
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://checkout.dintero.com/v1/sessions-profile",
    {
      method: "POST",
      headers: {
        Authorization: "Bearer ACCESS_TOKEN",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        url: {
          return_url: "https://example.com/thankyou",
          callback_url: "https://example.com/callback",
        },
        order: {
          amount: 29990, // 299.90 NOK
          currency: "NOK",
          merchant_reference: "order-001",
          items: [
            {
              id: "item-1",
              line_id: "1",
              description: "Blue T-Shirt",
              quantity: 1,
              amount: 29990,
              vat_amount: 5998,
              vat: 25,
            },
          ],
        },
        profile_id: "default",
      }),
    }
  );
  const session = await response.json();
  ```
</CodeGroup>

<Info>
  Amounts are in the smallest currency unit. `299.90 NOK` = `29990`.
</Info>

The response returns a session ID and checkout URL:

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

## Step 4: Display the checkout

Show the checkout to your customer using the [Web SDK](https://github.com/Dintero/Dintero.Checkout.Web.SDK). Install it with npm:

```sh theme={null}
npm install @dintero/checkout-web-sdk
```

<Info>
  Not sure which approach to use?

  **Redirect** sends the customer to a Dintero-hosted page — minimal setup, no iframe. **Embed** renders the checkout inside your page — more control over the experience.

  See the [SDK documentation](https://github.com/Dintero/Dintero.Checkout.Web.SDK) for a full comparison.
</Info>

<Tabs>
  <Tab title="Redirect">
    Send the customer to the Dintero-hosted payment page:

    ```js theme={null}
    import { redirect } from "@dintero/checkout-web-sdk";

    redirect({
      sid: "T12345678.xxxxxxxxxxxxxxxxxxxx",
    });
    ```

    Or redirect directly to the session `url` from step 3.
  </Tab>

  <Tab title="Embed">
    Embed the checkout in your page:

    ```html theme={null}
    <div id="checkout-container"></div>
    ```

    ```js theme={null}
    import { embed } from "@dintero/checkout-web-sdk";

    await embed({
      container: document.getElementById("checkout-container"),
      sid: "T12345678.xxxxxxxxxxxxxxxxxxxx",
    });
    ```
  </Tab>
</Tabs>

Use [test data](/docs/checkout/checkout-testdata) to complete a test payment.

## Step 5: Handle the result

After payment, Dintero notifies you through two channels:

| Channel           | How                | Reliable?                    | Use for                       |
| ----------------- | ------------------ | ---------------------------- | ----------------------------- |
| **callback\_url** | GET to your server | Yes (retried up to 20 times) | Verify payment, fulfill order |
| **return\_url**   | Customer redirect  | No (browser may close)       | Show confirmation page        |

<Warning>
  Always verify the transaction via the callback. The redirect is not guaranteed.
</Warning>

See [After payment](/docs/checkout/after-payment) for transaction statuses and handling.

## What's next

<CardGroup cols={2}>
  <Card title="Online store guide" icon="cart-shopping" href="/docs/checkout/quickstart">
    Full end-to-end integration including capture and refunds.
  </Card>

  <Card title="Embed vs redirect" icon="code" href="/docs/checkout/embedVredirect">
    Compare integration approaches.
  </Card>

  <Card title="Express Checkout" icon="bolt" href="/docs/checkout/express">
    Skip address forms for faster conversions.
  </Card>

  <Card title="Test data" icon="flask" href="/docs/checkout/checkout-testdata">
    Test cards and sandbox scenarios.
  </Card>
</CardGroup>
