1
Find the invoice
By the number your customer sees, or by your ERP’s id for it:
Response
external_id finds at most one invoice. number usually does too, but a number can repeat across customers,
so read the list. With Payra’s id, GET /invoices/{id} reads the invoice directly.2
3
Link to the payment page
Send the customer to
payment_url. The page shows the invoice and takes the payment; when it succeeds, the
invoice’s amount_paid and status change on your next read.Amounts and status
Amounts are integers in the currency’s smallest unit (cents), as everywhere in the API.totalis the invoice total.amount_paidis what was collected, refunds netted out.amount_pendingis what charges still processing will collect, such as a bank debit that has not settled. It is owed until a charge fails, and cannot be paid a second time meanwhile.amount_dueis what a payer can still pay today: the total less what was paid, pending or written off in the dashboard, and0once the invoice ispaidorcanceled(even when your ERP marked it paid without a payment through Payra). An early-payment discount the invoice offers is applied on the payment page, not here.
status is open while the invoice owes money, whether it has been sent or is still scheduled to be sent, and
paid or canceled once settled. past_due is true from the day after due_date while an open invoice is unpaid;
an invoice still scheduled to be sent is never past due. Drafts, and ERP invoices still awaiting approval in the
dashboard, are not listed.
The payment link
payment_url is the link Payra prints on its own invoice emails and reminders: the same URL every time you read the
invoice while it works, so you can store it or print it. It is null when there is nothing a payer could use: the
invoice is settled, nothing is left to pay while a charge is pending, the invoice or its link expired, the link was
revoked, or no link was ever made (an invoice created in the dashboard and never sent). Invoices that arrive from
an ERP get their link as they arrive. Sending the invoice again from the dashboard makes a new link; the earlier one
keeps working.
A payment made through the link is recorded on the invoice and shown in the dashboard like any other. It is not a
payment you created through the API, so it does not appear under Payments or in webhook
events: read the invoice to learn that it was paid, or let your ERP learn it through Payra Connect.
Scopes and errors
Reading and listing needinvoices:read. Keys created before this scope existed with every scope were given it;
a key you narrowed on purpose was not, and a new key gets it from the Invoices group.