The Invoice Object
Invoices are statements of amounts owed by a customer, and are either generated one-off, or generated periodically from a subscription.
Required scope: view-invoices
Attributes
| Parameter | Type | Description |
|---|---|---|
object | string | Always v2.invoice. |
id | string | The object's unique identifier. |
reference | string|null | A reference to your invoice. |
name | string | The name of the invoice (product or service) to pay. |
description | string|null | A brief description of the invoice. |
active | boolean | Whether the invoice is active. |
status | string | One of pending, paid, expired. |
amount | object|null | The invoice amount, as a money object. |
link | string | URL link to the invoice. |
due_by | string|null | When the invoice is due. |
created_at | string|null | When the invoice was created. |
deleted_at | string|null | When the invoice was deleted. |
Includes
Pass ?include=transactions on the details endpoint below to embed the invoice's Transaction objects under a transactions key. Not supported on the list endpoint.
Request
Endpoint: https://youcanpay.com/api/v2/invoices/{invoice_id}
Method: GET
bash
$ curl --location -g --request GET 'https://youcanpay.com/api/v2/invoices/inv_028ef20c-5065-4515-a0d6-a1c17ff0d53e' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_TOKEN_eyJpc3...'Response
json
{
"object": "v2.invoice",
"id": "inv_028ef20c-5065-4515-a0d6-a1c17ff0d53e",
"reference": "0000000016",
"name": "eee",
"description": "test test.",
"active": true,
"status": "pending",
"amount": {
"amount": "100.00",
"currency": "MAD",
"localized": "MAD 100.00"
},
"link": "https://youcanpay.com/i/TwRLnwU",
"due_by": null,
"created_at": "2024-01-28 22:35:20",
"deleted_at": null
}