On-demand billing
To create the first bill, an invoice for the subscription must be created. Please read more create invoice for subscription.
The amount for the invoice can either be taken from the plan using the plan_manual
flag or a number of given order_lines
, or a combination.
A refill agreement might have a fixed amount to refill with, in which case the plan amount is suitable, or it can be more custom, in which case an order line can be defined.
Below is an example with an order line provided and no plan amount.
curl -X POST \
-u 'priv_12051dfac75143fc827cf63a87f46df3:' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"handle": "invoice-007",
"instant": false,
"plan_manual": false,
"order_lines": [
{
"ordertext": "Refill of account",
"amount": 29900,
"vat": 0.25,
"quantity": 1
}
]
}' \
https://api.reepay.com/v1/subscription/cust-4234-refill-13/invoice
An invoice will now be created and handled by Billwerk+ Payments. Potentially going through dunning management. Alternatively, the flag instant can be used to indicate that the invoice should be processed instantly and either be returned as settled or failed. This way you the merchant will instantly know the result. The transactions in the invoice object can be used to determine why the payment failed.
When a new bill is generated by the merchant system, it is again created as an invoice in Billwerk+ Payments.
Updated 4 months ago