Split payments between merchants
Learn how to split a payment between the merchants you manage.
When one payment pays for the work of more than one business, you must tell Datman how to share the funds. For example, when a shopper orders a pizza for delivery, part of the payment can go to the delivery partner and the rest to the takeaway.
You define these split instructions in each API request. Each instruction books one part of the payment to another Datman merchant, under a split commission type: a label that says what that part of the payment is for, such as a delivery fee or a tip.
If you do not provide any split instructions, the whole payment is booked to the merchant that took the payment.
Before sending an API request with split instructions, make sure you understand:
- When to provide split instructions
- How to send split instructions
- Which split commission types you can use
Requirements
Before you begin, take into account the following requirements, limitations, and preparations.
| Requirement | Description |
|---|---|
| Integration type | You must have a hosted payment page integration. |
| API credentials | You need your api_token to manage split commission types and to adjust or refund payments. See Authentication. |
| Webhooks | Make sure that your server can receive and accept the payment status webhook. |
| Limitations | Each part of the payment must go to another Datman merchant, identified by its MID in partner_merchant_id. The total of all split amounts must be less than the payment amount. You can't send the same type_id twice for the same receiving merchant. The type_id must be a global type or one of your own custom types. |
To collect your own share of a payment, send the MID of your liable account in partner_merchant_id.
When to provide split instructions
You can provide split instructions for payments when you make the following requests:
- Open the hosted payment page, in the
split_feearray of the encrypted payload. - Adjust the amount of a pre-authorised payment, in the
split_feearray. The new split instructions replace the existing ones. If you don't sendsplit_fee, the existing split instructions are kept.
Note that when you capture a pre-authorised payment, the split instructions from the payment or the last adjustment are used. You can't send new split instructions in the capture request.
You can provide instructions to split refunds when you make the following request:
- Refund a payment, in the
refund_split_feearray. For each merchant that received part of the payment, specify thepartner_merchant_idand therefund_amountto take back.
Send split instructions
To split a payment at the time of payment:
-
Add a
split_feearray to your hosted payment page payload.For each item in the array, specify the following fields:
Parameter Required Description partner_merchant_idRequired The MID of the merchant that receives this part of the payment. type_idRequired The split commission type of this part of the payment. value_typeRequired amount to send a fixed amount, or percentage to send a percentage of the payment amount. valueRequired The amount, or the percentage when value_typeis percentage. Must be greater than 0. A percentage must be less than 100.For example, a shopper pays Example Pizza Ltd GBP 24.50 for a delivered order:
- With
type_id3 (Delivery Fee),value_typeamount andvalue3.50, we book GBP 3.50 to the delivery partner, Example Couriers Ltd (partner_merchant_id1000002). - The remaining GBP 21.00, before fees, is booked to Example Pizza Ltd.
Send your split instructions in the
split_feearray of the hosted payment page payload. The API Explorer has every field of the payload. - With
-
When the payment is captured, Datman sends a payment status webhook with a
split_fee_statusobject. It contains theoutcomeand amessagefor the split.
Troubleshooting
If the split instructions are not valid, the request fails. For example, an adjustment whose split amounts add up to the payment amount or more fails with the message Total split cannot be greater than or equal to order value.
To correct the balances after a payment is booked, you can transfer the funds between the merchants.
Track fund movements
To check how a payment was split:
-
Listen to the payment status webhook. On capture events for payments with split instructions, it contains
split_fee_status. -
Get the revenue split breakdown for the transaction, with the order reference in the path. The response contains one item for each share of the payment, with:
merchant_id: the merchant that receives the share.commission_type: the name of the split commission type.amountandamount_refunded: the amount of the share, and how much of it has been refunded.
Note that
amountandamount_refundedcan be returned as strings, such as "3.5000". Parse them as numbers.
Split commission types
In each split instruction, you must use the type_id field to define the purpose of that part of the payment.
Datman provides the following global types, which every partner can use:
type_id | Split commission type |
|---|---|
| 1 | Food/Goods |
| 2 | Marketplace Fee |
| 3 | Delivery Fee |
| 4 | Delivery Tip |
| 5 | Restaurant Tip |
| 6 | Service Charge |
You can also create custom types for your own business. Custom types have an ID above 100. Types with an ID of 100 or below are built in, and you can't change or delete them.
| Task | API reference |
|---|---|
| List the global types and your custom types | List split commission types. The response contains a global array and a custom array. Add the type_id query parameter to return one type. |
| Create a custom type | Create a split commission type with a commission_type name. The response contains the new type's id. Save it, because you need it as the type_id in your split instructions. |
| Rename a custom type | Rename a split commission type with the new commission_type name. |
| Delete a custom type | Delete a split commission type. |
Note that names must be unique among your types, ignoring case, and that this includes deleted types. A deleted type's name can't be reused.
Next steps
Transfer funds
Move funds between two merchants' balances.
Configure payout schedules
Change when a merchant's funds are paid out.

