Invoice, PaymentIntent and Payment
Overview
Every payment in TapPay goes through three objects: an Invoice, a PaymentIntent and a Payment. Each one answers a different question. Your API calls return small objects that hold the id of the related ones.
The three layers
| Object | What it is | Question it answers |
|---|---|---|
| Invoice | The full amount and its lines | What do you collect? |
| PaymentIntent | One attempt to pay a share of the invoice | How is the customer paying now? |
| Payment | The real transaction on a payment rail | What money moved? |
An invoice is what you ask the customer to pay. It has the amount, the order id and, if you send them, the order lines. It does not hold a QR code.
A PaymentIntent is one share of the invoice. It carries the QR code and a stable deeplink, and it has its own expiry time. You can show it on one or more channels.
A Payment is the actual transaction. Every payment belongs to a PaymentIntent. A card, a QR scan and a wallet transfer all create a payment.
How many of each
One invoice can have many intents. One intent can have many payments. A retry or an extra payment is a new payment under the same intent.
The open and paid shares together never exceed the invoice amount. One paid share does not close the invoice. The invoice closes when the full amount is paid.
Partial payment
The partialMode of the invoice sets how a customer may pay in parts. The modes are NONE, AMOUNT and LINES. A terminal can set the default.
With AMOUNT, each intent takes any amount. With LINES, each intent lists invoice lines and quantities, and its amount is the unit price times the quantity. An open intent locks those quantities. They are released when the intent expires or is cancelled.
One invoice cannot mix the two modes. An invoice without lines cannot use LINES and returns 422.
Expiry
An intent expires after the intent_ttl of the terminal. When an unpaid intent expires, its share returns to the invoice. If no other share was paid, the invoice expires too.
A paid share stays paid. The invoice then shows the status PARTIALLY_PAID. Once the invoice itself has expired, no new intent can be created. TapPay does not refund the paid money, and you decide what to do with the rest.
Overpaid
Two payers can pay the same QR code at nearly the same time. The first payment holds the code. If the second one still succeeds, that payment has the status OVERPAID. TapPay refunds it automatically on the same rail, with no fee.
Where checkout and payments fit
You rarely create these objects by hand. A checkout session creates the invoice and the intent together, and shows them on a hosted page. A payment without lines also creates one invoice and one intent, from a single call.
See Create a checkout session and Create a payment. The checkout flow is in the checkout guide.
Related objects and expand
A response stays short. A related object appears as its id, such as the intentId in an invoice. To get the full object in the same call, send expand[] with the field name.
TapPay never shows the provider or acquirer behind a payment. You see only the fields in the reference.