# Prefill data

Send what you already know about the order and the customer in the data object when you create a session, so the customer does not have to type it again.

When you [create a session](https://developer.briqpay.com/api-reference/create-session.md), you can fill the `data` object with what you already know. The checkout then shows it, and the customer does not have to enter it.

## What you can send

- `order`: the cart and amounts. See [Order line types](https://developer.briqpay.com/docs/order-lines.md).
- `company.cin`: the company identification number, and `company.name`. Only for `customerType: "business"`.
- `consumer`: `identificationNumber`, `dateOfBirth` (`YYYY-MM-DD`) and `name`. Only for `customerType: "consumer"`.
- `billing` and `shipping`: `firstName`, `lastName`, `email`, `phoneNumber`, `streetAddress`, `streetAddress2`, `zip`, `city`, `region`, `country` and `companyName`.

The customer's details are optional. `order` is required for a one-time payment and must have `currency` (three letters), `amountIncVat` and `cart`. The API reference marks `amountExVat` as required too, so send it as well.

> [!WARNING]
> Send only the object that matches `customerType`. If you send `company` for a consumer, or `consumer` for a business, the request still succeeds, but that object and the billing and shipping details are not saved.

## Example

```json title="Request body"
{
  "product": { "type": "payment", "intent": "payment_one_time" },
  "customerType": "consumer",
  "country": "SE",
  "locale": "sv-se",
  "urls": {
    "terms": "https://example.com/terms",
    "redirect": "https://example.com/confirmation"
  },
  "data": {
    "order": {
      "currency": "SEK",
      "amountIncVat": 105000,
      "amountExVat": 84000,
      "cart": [
        {
          "productType": "physical",
          "reference": "SKU-001",
          "name": "Desk lamp",
          "quantity": 1,
          "quantityUnit": "pc",
          "unitPrice": 84000,
          "taxRate": 2500,
          "discountPercentage": 0
        }
      ]
    },
    "consumer": {
      "dateOfBirth": "1985-04-12",
      "name": "Anna Andersson"
    },
    "billing": {
      "firstName": "Anna",
      "lastName": "Andersson",
      "email": "anna@example.com",
      "phoneNumber": "+46701234567",
      "streetAddress": "Storgatan 1",
      "zip": "11122",
      "city": "Stockholm",
      "country": "SE"
    },
    "shipping": {
      "firstName": "Anna",
      "lastName": "Andersson",
      "streetAddress": "Storgatan 1",
      "zip": "11122",
      "city": "Stockholm",
      "country": "SE"
    }
  }
}
```

## In the checkout

> [!IMPORTANT]
> The payment step stays locked until the session has the details it needs. Prefill them when you create the session, as described in the [Payment Module](https://developer.briqpay.com/docs/payment-module.md) guide.

In Briqpay's own billing and shipping steps, the customer can still edit prefilled details. To stop that, set `modules.config.billing.lockFields` or `modules.config.shipping.lockFields` to an object that gives each field name a lock: `hard_lock` allows no edits, and `soft_lock` locks a field only if it has a value. In the Payment Module setup those steps aren't shown, so there is nothing to lock. See [Create session](https://developer.briqpay.com/api-reference/create-session.md).
