Let the payer enter the amount
For a wallet top-up, a donation or a tab, leave the amount to the payer. Volume's checkout asks how much, between your limits, then how they pay.
Most checkouts are for an invoice you made, so the amount is yours. When the payer should choose it, a wallet top-up, say, open the checkout with limits in place of an invoice. Volume's checkout then asks the amount first, then how they pay, then shows the address. It works the same on the hosted page and in the popup.
Open the checkout
Pass open_amount instead of invoice_id: the least and the most the payer may enter,
in US dollars. Name the payer with customer_email, and say what the payment is for in
description if you like.
curl https://api.paywithvolume.com/v1/checkout_sessions \
-H "Authorization: Bearer $VOLUME_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"open_amount": { "minimum": "5.00", "maximum": "500.00" },
"description": "Wallet top-up",
"customer_email": "ada@example.com",
"success_url": "https://example.com/wallet",
"cancel_url": "https://example.com/wallet"
}'The checkout comes back with no invoice and no amount yet:
{
"object": "checkout_session",
"id": "cs_7Kq2Wd9Tn4xR1bLm5HvZp8Sc",
"url": "https://paywithvolume.com/cs_7Kq2Wd9Tn4xR1bLm5HvZp8Sc",
"status": "open",
"invoice": null,
"amount": null,
"description": "Wallet top-up",
"open_amount": { "minimum": "5.00", "maximum": "500.00" },
"pay_with": null
}Send the payer to its url. It is open for 24 hours, like any checkout.
What the payer sees
- The amount. "Pay" and your business's name, your description, one field in dollars, and your limits under it ("From $5 to $500"). An amount outside them is refused there, and they try again.
- How they pay. Bitcoin, Lightning, Tether USD or USD Coin, under "Pay $40 to" your business.
- The address. The network, the address and QR code, and the exact amount to send, with their 30 minutes to send it.
Once they enter the amount, Volume makes your invoice for it, for that customer and with
your description, and the checkout reads like any other: invoice and amount are
set, and from there it is paid, followed, receipted and paid out to you as usual. The
amount cannot be changed after that: for a different one, open a new checkout.
To skip the second step too, add pay_with: the
payer enters the amount, then goes straight to the address for that coin.
Limits
minimumis more than0.00and no more thanmaximum.maximumis at most100000.00, as for any invoice.- With
pay_withonlightning,maximumis at most1000.00, the most a Lightning payment carries. Withoutpay_with, Lightning is offered only when the amount entered is $1,000 or less.
What can be refused
| Status | code | When |
|---|---|---|
| 400 | invalid_request | Neither invoice_id nor open_amount, or both; or description with an invoice_id, whose invoice carries its own. |
| 400 | invalid_amount | A minimum of 0.00, or above maximum. |
| 400 | amount_too_large | A maximum above 100000.00. |
| 400 | unsupported_payment_method | pay_with on lightning with a maximum above 1000.00. |
| 400 | customer_email_required | No customer_email. |
Reading it back
Until the payer enters the amount, invoice and amount are null. Only a checkout
made with open_amount can have them null: a checkout for an invoice always has both.
Your webhooks are the same as for any checkout: act on invoice.paid, whose
checkout_session carries the amount the payer chose as amount_usd.
If the checkout expires before the payer enters anything, invoice.expired is sent
with invoice_id and amount_usd null.