mollie / mollie-api-node

Official Mollie API client for Node
http://www.mollie.com
BSD 3-Clause "New" or "Revised" License
231 stars 63 forks source link

Split payments #273

Open JFGHT opened 2 years ago

JFGHT commented 2 years ago

Hello there.

Does the node api support split payments?

Thanks.

Pimm commented 2 years ago

Although not officially supported, it should work:

mollieClient.payments.create({
    amount: { currency: 'EUR', value: '10.00' },
    routing: [
        {
            amount: { currency: 'EUR', value: '2.50' },
            destination: { type: 'organization', organizationId: 'me' }
        },
        {
            amount: { currency: 'EUR', value: '3.50' },
            destination: { type: 'organization', organizationId: 'org_23456' }
        },
        {
            amount: { currency: 'EUR', value: '4.00' },
            destination: { type: 'organization', organizationId: 'org_56789' }
        }
    ],
    …
});

(Note that ‒ as routing does not exist according to the type definitions ‒ the TypeScript compiler will complain if you're using it.)

Once this feature moves out of closed beta, official support to this client should be added.