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

# Create a session with split payments

> Create Dintero Checkout sessions with split payouts that route funds to multiple sellers, for marketplaces, platform fees, and multi-merchant transactions.

With Dintero Payout, you can split the funds between any number of sellers. For example, when a customer
pays on your platform, you can split the funds so that a part goes to your own seller as platform fee and
the sale amount goes to the sales location seller

## Providing split information

You can provide split information:

* When [creating](https://docs.dintero.com/api-reference/session/checkout_session_profile_post.md) new payment
  session
* When [capturing](https://docs.dintero.com/api-reference/transactions/transactions_id_capture_post.md) the payment
  transaction
* When [refunding](https://docs.dintero.com/api-reference/transactions/transactions_id_refund_post.md) the payment
  transaction

To split the payment, you will need to include the **splits** array in the session order items. For each split object in
the array, you need to specify the following fields:

* **`payout_destination_id`**: The destination that will receive the split
* **`amount`**: The split amount

For example, a customer pays for goods for 499,90 NOK, you can split the payment such that:

* 399,90 NOK goes to the merchant
* 70,00 NOK goes to the platform
* 30,00 NOK is a donation to a charity

> [!NOTE]
>
> Dintero supports as many sellers as you need, but there might be limitations based on item amounts.

```json theme={null}
{
  "order": {
    "items": [
      {
        "splits": [
          {
            "payout_destination_id": "merchant",
            "amount": 39990
          },
          {
            "payout_destination_id": "platform",
            "amount": 7000
          },
          {
            "payout_destination_id": "charitable_organization",
            "amount": 3000
          }
        ]
      }
    ]
  }
}
```

### Aggregators

Aggregators must specify the merchant of record of the transaction.

> [!NOTE]
>
> You will be informed during onboarding to Dintero about whether you are a marketplace or aggregator.

To specify the merchant of record, include `store.payout_destination_id` in the order:

```json theme={null}
{
  "order": {
    "store": {
      "id": "my-store-id",
      "payout_destination_id": "merchant"
    }
  }
}
```

## Validating split information

The Checkout service only validate the format of the split data. The seller in the splits will **not** be
validated.

If you provide split data with a seller that does not exist or the seller is not approved for
payout, the payout for the destination will be postponed until the issue with the seller has been resolved

## Providing fee split information

The default behaviour when splits are used is to let the fees be shared proportional with all split destinations.

The default behaviour can be overridden by including `fee_split` when setting
**splits**

### Override default fee split

Example under shows how a split destination can be configured to handle the fees.

```json theme={null}
{
  "order": {
    "items": [
      {
        "splits": [
          {
            "payout_destination_id": "merchant",
            "amount": 39990
          },
          {
            "payout_destination_id": "platform",
            "amount": 7000
          },
          {
            "payout_destination_id": "charitable_organization",
            "amount": 3000
          }
        ],
        "fee_split": {
          "type": "proportional",
          "destinations": [
            "platform"
          ]
        }
      }
    ]
  }
}

```

> [!NOTE]
>
> Sellers that are excluded from fees will receive the whole amount when the payout is settled

### Fee-only destinations

Use `fee_split.type: "equal_fee_only"` when a destination should only cover fees and never
receive any income from the order. Unlike `proportional`, `equal_fee_only` destinations must
not be included in **splits** - they accumulate fee debt without ever being paid out a share
of the sale.

If multiple destinations are listed, the fee is divided equally between them.

In the example below, the destinations listed in `items[].splits` receives the amount
in its entirity. `platform` covers the entire fee but does not appear in `splits`, so it
receives no income from the order.

```json theme={null}
{
  "order": {
    "items": [
      {
        "splits": [
          {
            "payout_destination_id": "receiver_a",
            "amount": 29900
          }
        ],
        "fee_split": {
          "type": "equal_fee_only",
          "destinations": [
            "platform"
          ]
        }
      },
      {
        "splits": [
          {
            "payout_destination_id": "receiver_b",
            "amount": 19900
          }
        ],
        "fee_split": {
          "type": "equal_fee_only",
          "destinations": [
            "platform"
          ]
        }
      }
    ]
  }
}
```

## Full example of creating a session

When put together, we can call [https://api.dintero.com/v1/accounts/{account_id}/payments/sessions-profile](https://docs.dintero.com/api-reference/session/checkout_session_profile_post.md) with a payload with the following
content.

If you want non-standard fee splits, see "Override default fee split" above.

```json theme={null}
{
  "url": {
    "return_url": "https://example.com/accept",
    "callback_url": "https://example.com/callback?method=GET",
    "merchant_terms_url": "https://example.com/terms.html"
  },
  "customer": {
    "email": "john.doe@example.com",
    "phone_number": "+4799999999"
  },
  "order": {
    "amount": 49990,
    "currency": "NOK",
    "vat_amount": 6000,
    "items": [
      {
        "id": "item_01",
        "line_id": "1",
        "description": "Stablestol",
        "quantity": 1,
        "amount": 49990,
        "vat_amount": 9998,
        "vat": 25,
        "splits": [
          {
            "payout_destination_id": "merchant",
            "amount": 39990
          },
          {
            "payout_destination_id": "platform",
            "amount": 7000
          },
          {
            "payout_destination_id": "charitable_organization",
            "amount": 3000
          }
        ]
      }
    ],
    "merchant_reference": "merchants_unique_id"
  },
  "profile_id": "default"
}
```

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

## Capture and refund

When capturing or refunding a split-payment you can do a full capture or full refund using only the total order amount defined in the session. For full captures and refunds the capture and refund operation will use the splits as defined in the session.

If you want to do a partial capture or a partial refund, the operation request body will also need to include the items and the splits for the items that are captured or refunded. It is also possible to use a different split from what is defined in the session when the items with splits are defined in the capture and refund operations. It is also possible to capture and refund asymmetrically, for instance it is possible to define that one party in the split will cover the entire refund.

> [!WARNING]
>
> `fee_split` set on the session is **not** carried over to partial capture or refund operations. When you include `items` and `splits` in a capture or refund request, you must also re-supply `fee_split` for each item. Otherwise the fees fall back to the default behaviour and are shared proportionally across all `payout_destination_id`s in the splits.

For example, when partially capturing an item where the platform should cover all fees, include `fee_split` on the item just as you did when creating the session:

```json theme={null}
{
  "amount": 19500,
  "items": [
    {
      "id": "item_1",
      "line_id": "1",
      "quantity": 1,
      "amount": 19500,
      "vat": 15,
      "splits": [
        {
          "payout_destination_id": "farmer-cmmaj13c5004fn601ohx4z2ti",
          "amount": 18583
        },
        {
          "payout_destination_id": "platform",
          "amount": 917
        }
      ],
      "fee_split": {
        "type": "proportional",
        "destinations": [
          "platform"
        ]
      }
    }
  ]
}
```

* [API specification for the capture operation](https://docs.dintero.com/api-reference/transactions/transactions_id_capture_post.md)
* [API specification for the refund operation](https://docs.dintero.com/api-reference/transactions/transactions_id_refund_post.md)


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