> ## 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.

# Consent and marketing checkboxes

> Add custom checkboxes to Express Checkout to collect marketing consent, newsletter signup, or terms acceptance, and read the customer's choice from the transaction.

You can add up to two custom checkboxes to an Express Checkout session. Use them to collect input from the customer during payment, for example:

* Marketing consent, such as permission to send offers by email or SMS
* Newsletter signup
* Acceptance of your own terms, such as membership or club terms

The customer's choice is stored on the transaction, so you can act on it after payment.

![Express Checkout with a custom checkbox below the customer details](https://mintcdn.com/dintero-c3a7bfec/u32FcZKh3IK_yuYw/docs/assets/checkout/checkout-express.png?fit=max\&auto=format\&n=u32FcZKh3IK_yuYw\&q=85\&s=f2f381254122dd622f3091737a8d048c)

> [!NOTE]
>
> Custom checkboxes are available in [Express Checkout](https://docs.dintero.com/docs/checkout/express.md) only.

> [!NOTE]
>
> If you use an e-commerce platform or plugin, the platform creates the session for you. Ask your platform provider if they support custom checkboxes, since the platform also needs to read the customer's choice from the transaction.

## Add checkboxes to a session

Add a top-level `checkboxes` array when you [create the session](https://docs.dintero.com/api-reference/session/checkout_session_profile_post.md).

```bash Request wrap theme={null}
curl -X POST https://api.dintero.com/v1/accounts/{account_id}/payments/sessions-profile \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <TOKEN>" \
  -d '{
    "url": {
      "return_url": "https://example.com/thankyou",
      "callback_url": "https://example.com/callback"
    },
    "order": {
      "amount": 29990,
      "currency": "NOK",
      "merchant_reference": "merchants_order_number"
    },
    "express": {
      "shipping_options": []
    },
    "checkboxes": [
      {
        "id": "marketing_email",
        "label": "Send me offers and news by email",
        "checked": false,
        "required": false,
        "link": {
          "url": "https://example.com/privacy",
          "text": "Privacy policy"
        }
      }
    ],
    "profile_id": "default"
  }'
```

| Field | Required | Description |
| - | - | - |
| `id` | Yes | Your ID for the checkbox. Use it to find the customer's choice on the transaction. |
| `label` | Yes | Text shown next to the checkbox. Must be 2 to 99 characters. |
| `checked` | No | Set to `true` to check the checkbox by default. |
| `required` | No | Set to `true` to require the customer to check the checkbox before paying. |
| `link` | No | Link shown with the checkbox, with `url` and `text`. Use it to link to your privacy policy or terms. |

> [!TIP]
>
> For marketing consent, leave `checked` as `false` and `required` as `false`. Consent rules such as the GDPR do not accept pre-checked boxes or consent that the customer must give to complete a purchase.

### Use the same checkboxes for every session

To apply the same checkboxes to every session that uses a profile, set `configuration.checkboxes` on the [session profile](https://docs.dintero.com/docs/checkout/payment-profiles.md) instead of on each session.

## Read the customer's choice

When the customer checks or unchecks a checkbox, the checkout updates the session. After payment, the transaction includes a `checkboxes` array with the final `checked` value for each checkbox.

**1. Get the transaction ID**

Read `transaction_id` from the [callback or return URL](https://docs.dintero.com/docs/checkout/after-payment.md).

**2. Fetch the transaction**

Call [GET /transactions/\{id}](https://docs.dintero.com/api-reference/transactions/transactions_id_get.md).

```bash Request wrap theme={null}
curl https://api.dintero.com/v1/accounts/{account_id}/payments/transactions/{transaction_id} \
  -H "Authorization: Bearer <TOKEN>"
```

**3. Find the checkbox by ID**

Look up the checkbox in `checkboxes` by the `id` you set on the session. Use `customer.email` or `customer.phone_number` to identify who gave consent.

```json Response theme={null}
{
  "id": "T12345678.4Xyz1aBcDeFgHiJkLmNoPq",
  "session_id": "T12345678.4Xyz1aBcDeFgHiJkLmNoP",
  "status": "AUTHORIZED",
  "amount": 29990,
  "currency": "NOK",
  "merchant_reference": "merchants_order_number",
  "customer": {
    "email": "john.doe@example.com",
    "phone_number": "+4799999999"
  },
  "checkboxes": [
    {
      "id": "marketing_email",
      "label": "Send me offers and news by email",
      "checked": true,
      "required": false,
      "link": {
        "url": "https://example.com/privacy",
        "text": "Privacy policy"
      }
    }
  ]
}
```

The response is shortened. In this example, `checked` is `true`, so the customer gave consent to receive offers by email.

> [!TIP]
>
> Store the label text together with the consent. The label shows exactly what the customer agreed to.


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