# Split Payment

## Overview

Ryft supports scenarios where multiple entities are involved in a single transaction. This is known as a **Split Payment**. In this model, the Main Account collects the total amount from the customer and then automatically distributes the funds among one or more Sub-Accounts. As with the Platform Fee model, the Main Account may retain a portion of the payment as a service fee for facilitating the transaction.

For more information about Split Payments, please refer to [this](/documentation/overview/payment_types/platform_fee_split_payments#split-payments) page.

## Practical Example

Let’s revisit the food delivery scenario from the Platform Fee model. This time, however, the customer adds items from three different restaurants to their basket:

| Quantity | Item Name | Item Price | Restaurant |
|  --- | --- | --- | --- |
| 1 | Beef Wellington | £28.00 | Restaurant A |
| 2 | Ahi Tuna Poke Bowl | £14.50 | Restaurant B |
| 2 | Sticky Toffee Pudding | £7.00 | Restaurant C |
| **Total** |  | **£71.00** |  |


In this scenario, the **Main Account** processes the payment on behalf of three **Sub-Accounts** (i.e. the three restaurants). For providing the platform and facilitating the transaction, the Main Account decides to charge a Platform Fee of 10% to each Sub-Account, which makes the platform fees divided as follows:

- Restaurant A: £2.80 (10% of £28.00 x 1)
- Restaurant B: £2.90 (10% of £14.50 x 2)
- Restaurant C: £1.40 (10% of £7.00 x 2)


## Payment Session

The related Payment Session considering this scenario when using the **Split Payment** model will be structured as follows:

**Example Request**:

```json paymentSessionCreate - Payload Example
{
    "amount": 7100,
    "currency": "GBP",
    "customerEmail": "customer@mail.com",
    "splits": {
        "items": [
            {
                "accountId": "ac_123456789",  // Restaurant A
                "amount": 2800,
                "fee": {"amount": 280}
            },
            {
                "accountId": "ac_246810121",  // Restaurant B
                "amount": 2900,
                "fee": {"amount": 290}
            },
            {
                "accountId": "ac_369121518",  // Restaurant C
                "amount": 1400,
                "fee": {"amount": 140}
            }
        ]
    }
}
```

With this set-up:

- The **Customer** is charged exactly the amount specified in the `amount` field: £71.00
- The **Main Account** receives a total amount of Platform Fee of £7.10, minus any applicable Ryft processing fees
- The **Sub-Account related to Restaurant A** receives £25.20, which is the total amount for their food order (£28.00) minus the Platform Fee (£2.80).
- The **Sub-Account related to Restaurant B** receives £26.10, which is the total amount for their food order (£29.00) minus the Platform Fee (£2.90).
- The **Sub-Account related to Restaurant C** receives £12.60, which is the total amount for their food order (£14.00) minus the Platform Fee (£1.40).


The API returns a payload containing the details of the payment initialisation, including the `clientSecret` value, which is required to process the payment.

## Viewing Split Payments in the Ryft Portal

Payments created and processed using the **Split Payment** model can be viewed in the Ryft Portal as follows:

- For **Main Account** holders on the **Payments** page. When selecting a payment, the details of the split, including platform fees and Sub-Account distributions, will be shown.
- For **Sub-Accounts onboarded using the Hosted** flow, via the **Split Payments** page.


## Next Steps

- Process payment - see [here](/documentation/get_started/process_payments).
- Update payment - see [here](/documentation/get_started/manage_payments).
- View payment details - see [here](/documentation/get_started/portal/payments).