Distribution

General Information

The funds received as a result of invoice payment are typically credited to the bank details specified during the Marketplace setup (unless other adjustments were made). If the funds need to be distributed across different accounts (different contractors, service providers, etc.), the amountDistribution field is used when creating the invoice. The amountDistribution field is a JSON array consisting of objects in the following format:
typescript
type TDistribution = { "recipient": { "name": string, "tin": string, "bic": string, "bankName": string, "bankAccount": string }, "amount": string, "order": number, "vor": boolean, "isFeePayer": boolean, "overpaymentPart": number }
FieldTypeRequiredDescription
recipientobjectYesThese are the recipient details. It corresponds to the RecipientField type. You can see the description in the Playground API DOCS.
amountstringYesThe amount to be transferred.
ordernumberNoThe order of fund distribution. Default value is 0. It is used for fine-tuning in the case of partial payments.
vorbooleanNoAbbreviation for Victim of Rounding. Indicates who will bear the rounding result. For example, if 100 is divided by 3, two recipients will receive 33.33, and the one with vor: true will receive 33.34.
isFeePayerbooleanNoShows which recipient will pay the service fee.
overpaymentPartnumberNoSpecifies the share of the overpayment that will be sent to the recipient. For example, if only one recipient has overpaymentPart: 1, they will receive the entire overpayment. If two recipients have overpaymentPart: 1, each will receive half of the overpayment. All fields and their types are specified in the data schema available in the sandbox: https://condo.d.doma.ai/admin/api.
Limitations:
  • Maximum number of recipients: 5.
  • Recipient details must be pre-added to the system. This is done by contacting technical support.
  • Recipients must be unique. Two recipients cannot have identical details in the distribution.
  • The total distribution amount must match the invoice amount. You cannot distribute only part of the funds.
  • In each group (recipients with the same order), there must be exactly one recipient with vor: true.
  • The recipient with vor: true must also be one of the fee payers (isFeePayer: true) and receive part of the overpayment (overpaymentPart).

Distribution Examples

For simplicity, we will use a string instead of the recipient object.

Example 1: Basic

The simplest distribution. No partial payment, no overpayment. Just a regular invoice payment with two recipients.
Invoice amount: 1000
json
{ "amountDistribution": [ {"recipient": "recipient1", "amount": "200", "vor": true, "isFeePayer": true, "overpaymentPart": 1 }, {"recipient": "recipient2", "amount": "800" } ] }
Payment amount: 1000
Fee: 5%
Distribution result:
RecipientAmount
recipient1150
recipient2800
fee50

Example 2: Rounding

An example showing how vor: true works. Here there are three recipients, and all of them pay the fee. No partial payment, no overpayment. Just a regular invoice payment with three recipients.
Invoice amount: 300
json
{ "amountDistribution": [ {"recipient": "recipient1", "amount": "100", "isFeePayer": true }, {"recipient": "recipient2", "amount": "100", "vor": true, "overpaymentPart": 1, "isFeePayer": true }, {"recipient": "recipient3", "amount": "100", "isFeePayer": true } ] }
Payment amount: 300
Fee: 10 (3.33333%)
Distribution result:
RecipientAmount
recipient196.67
recipient296.66
recipient396.67
fee10

Sandbox

The sandbox below allows for distribution calculations.
Payment amount:
Payment fee: