Invoice
An Invoice is a statement of what a customer owes, with a page where they can pay it. An invoice starts as a draft you can edit freely. Finalizing it assigns its number, freezes its amounts and the customer's details, and makes it payable. A finalized invoice is never edited: correct it with a credit note, or revise it, which replaces it with a new invoice. An invoice can take several payments, online or recorded by you, and is paid when nothing remains.
An Invoice is a statement of what a customer owes, with a page where they can pay it. An invoice starts as a draft you can edit freely. Finalizing it assigns its number, freezes its amounts and the customer's details, and makes it payable. A finalized invoice is never edited: correct it with a credit note, or revise it, which replaces it with a new invoice. An invoice can take several payments, online or recorded by you, and is paid when nothing remains.
{ "id": "in_3Nf8a2kLmPq9", "object": "invoice", "merchantId": "string", "livemode": true, "status": "draft", "displayStatus": "draft", "number": "INV-000127", "collectionMethod": "send_invoice", "billingReason": "manual", "currency": "EGP", "customerId": "string", "customerName": "string", "customerEmail": "string", "customerPhone": "string", "issueDate": "string", "dueDate": "string", "daysUntilDue": -9007199254740991, "isOverdue": true, "daysOverdue": -9007199254740991, "total": -9007199254740991, "amountDue": -9007199254740991, "amountPaid": -9007199254740991, "amountRemaining": -9007199254740991, "statusTransitions": { "finalizedAt": "string", "paidAt": "string", "markedUncollectibleAt": "string", "voidedAt": "string" }, "sentAt": "string", "firstViewedAt": "string", "automaticallyFinalizesAt": "string", "createdAt": "string", "updatedAt": "string", "customerAddress": { "line1": "string", "line2": "string", "city": "string", "state": "string", "postalCode": "string", "country": "string", "property1": null, "property2": null }, "customerShipping": { "line1": "string", "line2": "string", "city": "string", "state": "string", "postalCode": "string", "country": "string", "property1": null, "property2": null }, "customerTaxIds": [ { "type": "string", "value": "string" } ], "customerLocale": "ar", "accountName": "string", "accountTaxNumber": "string", "subtotal": -9007199254740991, "totalDiscountAmounts": [ { "amount": -9007199254740991, "name": "string" } ], "subtotalExcludingTax": -9007199254740991, "totalExcludingTax": -9007199254740991, "totalTaxes": [ { "amount": -9007199254740991, "taxableAmount": -9007199254740991, "taxBehavior": "exclusive", "taxRateDetails": {} } ], "amountShipping": -9007199254740991, "shippingCost": { "amountSubtotal": -9007199254740991, "amountTax": -9007199254740991, "amountTotal": -9007199254740991, "taxRateIds": [ "string" ] }, "startingBalance": -9007199254740991, "endingBalance": -9007199254740991, "prePaymentCreditNotesAmount": -9007199254740991, "postPaymentCreditNotesAmount": -9007199254740991, "amountOverpaid": -9007199254740991, "description": "string", "footer": "string", "customFields": [ { "name": "string", "value": "string" } ], "discounts": [ { "type": "percent", "percent": 0, "amount": -9007199254740991, "name": "string", "couponId": "string", "appliedAmount": -9007199254740991 } ], "defaultTaxRateIds": [ "string" ], "lines": [ { "id": "il_3Nf8a2kLmPq9", "object": "line_item", "position": -9007199254740991, "description": "string", "quantity": 0, "unitLabel": "string", "pricing": { "priceDetails": {} }, "period": {}, "discounts": [ null ], "taxRateIds": [ null ], "inheritsDefaultTaxRates": true, "subtotal": -9007199254740991, "discountAmounts": [ {} ], "amount": -9007199254740991, "taxes": [ null ], "amountExcludingTax": -9007199254740991, "amountTotal": -9007199254740991, "metadata": {} } ], "installments": [ { "id": "inst_3Nf8a2kLmPq9", "object": "invoice_installment", "position": -9007199254740991, "description": "string", "amountDue": -9007199254740991, "amountPaid": -9007199254740991, "dueDate": "string", "status": "open" } ], "payments": [ { "id": "inpay_3Nf8a2kLmPq9", "object": "invoice_payment", "invoiceId": "string", "status": "open", "amountRequested": -9007199254740991, "amountPaid": -9007199254740991, "amountRefunded": -9007199254740991, "currency": "EGP", "payment": { "paymentRecord": {} }, "statusTransitions": {}, "installmentId": "string", "receiptNumber": "string", "receiptUrl": "string", "merchantId": "string", "createdAt": "string", "updatedAt": "string" } ], "paymentSettings": { "paymentMethodTypes": [ "card" ] }, "allowPartialPayments": true, "minimumPartialAmount": -9007199254740991, "locale": "auto", "pdfLanguage": "ar", "delivery": { "channels": [ "email" ], "additionalRecipients": [ "string" ], "message": "string" }, "autoAdvance": true, "templateId": "string", "fromInvoice": { "action": "revision", "invoiceId": "string" }, "latestRevisionId": "string", "hostedInvoiceUrl": "string", "hostedInvoiceUrlExpiresAt": "string", "metadata": { "property1": null, "property2": null }}Invoice Payment
An Invoice Payment is one payment made on an invoice. An invoice can have several: one per part payment or installment. A payment is backed by a PaymentIntent when the customer paid online, or by a payment record when the merchant recorded money received outside XPay, such as cash or a cheque. Money returned from a payment is shown in amountRefunded and documented by a credit note; the payment's status stays paid.
Payment Intent
A PaymentIntent tracks the full lifecycle of collecting one payment from your customer: from creation, through authorization and 3-D Secure, to capture and final outcome. We recommend creating one PaymentIntent per order: you can inspect its history of Charge attempts, watch its `status` as it transitions, and reference the successful Charge it ultimately produces. PaymentIntents are the object that the hosted Checkout and xpay.js drive on the client to complete a payment.