Creating a Payment Batch
4 minute read
This guide gives you a walkthrough on how to create many asynchronous payments aka Payment Batch simultaneously. After this you will have a clear understanding of what a Payment Batch is and when it's suitable to use and how to use it.
This guide assumes you have read Key Concepts and followed the guide Creating a Payment.
Use cases
Batch payments allow you to submit multiple payments in a single API request, with each payment processed asynchronously as soon as possible. This is ideal for recurring billing scenarios where you need to charge many customers at once.
This way you can initiate and process a large number of payments much faster instead of creating 1000s individual Payment and PaymentOrders.
Payment Methods
Only payment methods that are asynchronous and don't require interactive user flows are batchable:
| Provider | Method | Currency |
|---|---|---|
swish | recurring | SEK |
bankgirot | autogiro | SEK |
ping | deposit | SEK, NOK, EUR |
How it works
- Submit batch - POST to
/api/v1/payment_batcheswith all entries - Receive batch ID - Response returns immediately after validation
- Async processing - Each entry is processed independently. If one payment fails, others continue processing
- Status callbacks - Each payment sends its own callback as it completes
API Usage
The batch API uses the same PaymentOrder and Payment request bodies as the standard payment flow. If you’ve already integrated single payments, the structure will be familiar—batch payments simply wrap multiple entries into a single request.
When using batch payments we recommend that you generate and provide your own IDs for the Payments and PaymentOrders since they will be a part of the payment callback and are needed to identify the payment
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
batch | array | Yes | Array of batch entries |
batch[].payment_order | object | Yes | Payment order object. Same structure as Create Payment Order |
batch[].payment | object | Yes | Payment object. Same structure as Initiate Payment |
Response Body
| Name | Type | Description |
|---|---|---|
id | string | UUID of the created payment batch |
Updated 12 days ago