Create an invoice
create_invoiceCreate a crypto invoice from line items or a single amount, assign a customer, and get a payment URL where the buyer pays in bitcoin or a stablecoin.
Instructions
Create an invoice.
Lines are prices ({ price, quantity }) or your own ({ description, amount, quantity }), in one currency. For a single amount, amount + description is short for one line. customer is an id or { email }. A price line may carry its own description ("Seat #12"), and discount takes an amount off this invoice alone. The buyer pays at url, choosing bitcoin or a stablecoin there. Live mode: a new invoice is refused with 403 bill_overdue while a Perly Pay bill is unpaid past its 14 days, until it is paid in the dashboard's Billing; invoices already made are still paid.
Test keys only: refused with a live key.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | No | One amount instead of line_items in minor units (cents), an integer. | |
| coupon | No | ||
| locale | No | ||
| currency | No | For lines without a price. Default: your account's currency. | |
| customer | No | A customer id, or `{ email }` to find or make one. | |
| discount | No | A one-off amount off this invoice (a credit you owe the buyer; not with `coupon`) in minor units (cents), an integer. | |
| metadata | No | Your own key–value pairs (≤ 50 keys, values ≤ 500 characters). On an update they are merged in; an empty value removes its key. | |
| line_items | No | ||
| return_url | No | Where the buyer's page sends them back. | |
| description | No | With `amount`: what it is for. | |
| subscription | No | A subscription id, `sub_…`. | |
| customer_email | No | Without `customer`: finds or makes the customer by email. | |
| expires_in_minutes | No | Until when a rail may be chosen. |