POST /v2/debts.
How it works
The model relies on three pieces:Products
Every debt belongs to a product (for example “Tuition”). Direct debit is managed per product: when a user enrolls, they enroll the whole product.
Default payment method
The user registers their account once through the TapiPay enrollment page (not via API). That method becomes the default and executes collections.
Debts v2
You create debts via API referencing the product. The response tells you whether automatic collection is active and why.
On
POST /v2/debts the debt does not declare a payment method: the paymentMethods and autopay fields are not accepted and return 400 INVALID_REQUEST (they only apply to subscriptions). If the user has a debitable default, the adhesion is managed automatically on every debt creation.Prerequisites
- Your company must have the default payment method feature enabled (configured with your Tapi account executive).
- Your products must exist before creating debts. You can create them with your own identifier (
externalProductId) so you never store Tapi IDs.
Create a debt
Product identity travels through exactly one of these two fields (never both):
The rest of the contract matches creating a debt: amount, due date, debtor.
201 response
autopayReason only appears in the response when autopay is false (the rejection reason). When autopay is true, the key is absent. autopayInstrument only appears when autopay is true.Create several debts in one request
The same endpoint accepts up to 50 debts per request through thedebts envelope. Each item has the same contract as a single debt plus a mandatory externalRequestId, unique within the batch: it is the idempotency key of each debt (the Idempotency-Key header is not used in this mode).
If the body carries debts, only debts is accepted at the top level: any other root field returns 400. A JSON array at the root, without the { "debts": [...] } envelope, also returns 400.
Debts in a batch are created independently: one failing in the collections system does not stop the others. The
code values in errors[] are the same the endpoint returns for a single debt. An externalRequestId that already existed returns the existing debt without duplicating it.The automatic collection outcome
Every response includesautopay and, when it is false, the reason in autopayReason:
autopayInstrument is a reference to the instrument: sensitive data never travels (the bank account number is neither exposed nor stored by this service).
Query a user’s payment methods
GET /payment-methods lists the references of the methods a user registered. externalClientId is required, must be exactly the same identifier used at enrollment, and does not accept the characters ', ", \, ;. The response is not paginated.
200 response
paymentMethodType can be:
If the
externalClientId has no registered methods or does not exist, the response is 200 with data: []. Besides the 400 for a missing or invalid externalClientId, the endpoint can respond 404 RESOURCE_NOT_FOUND or 422 BUSINESS_RULE_VIOLATION.
Rules to keep in mind
- One default per user: the first registered method becomes the default automatically; later ones do not displace it unless explicitly requested during enrollment.
- Nonexistent product: a
productIdorexternalProductIdthat does not exist returns404 RESOURCE_NOT_FOUNDand the debt is not created.

