Skip to main content

Create Payment Batches from barcodes

POST 

/v2/payments/barcode_batches

Batch version of POST /api/v2/payments/barcode: it receives a list of barcodes or typable lines, classifies each one and creates the corresponding Payment Batches.

A Payment Batch only holds payments of one type. So the list is grouped by the type resolved for each code and becomes one batch per type, at most three (bank_billet, utility and tax), created together: if a single code is invalid, no batch is created and the 422 response points to the index in the error param (payments[2].code).

The items field of the response links each received code, by index, to the payment and the batch it landed in.

Prerequisites​

payment_account_uid is required, sits at the root and applies to all batches. financial_account_uid is ignored: the financial account is the one of the payment account.

A null in the list is refused at its own index, and a code that repeats the one of a previous item (including the typable line and the barcode of the same document) is refused in payments[i].code. When a payment is refused only when it is saved (e.g. scheduled_to in the past), the 422 response brings the errors of all batches together.

amount is optional in each payment when the code carries the amount to pay, with the same rule as POST /api/v2/payments/barcode: collection with value identifier 6 or 8 (3rd position) and boleto with a non-zero amount. Without amount, the payment uses the amount in the code; for a boleto, it is the face value, without interest, fine or discount. It is required for collection with identifier 7 or 9, in which the amount in the code is only a reference, and when the code comes with a zero amount.

Webhook Events​

The payment.batch.db.created event is fired for each batch created and payment.db.created for each payment, only after all batches are saved: in a 422 response no event is fired.

With the automation rule payment_batch.created.register active in the account, each batch created is sent for registration at the financial institution, as in the per-type batch endpoints.

Request​

Responses​

Batches created, one per resolved type