The Invoice Object
Invoices are statements of amounts owed by a customer, and are either generated one-off, or generated periodically from a subscription.
Attributes
| Parameter | Type | Description |
|---|---|---|
id | string | The object's unique identifier. |
reference | string | A reference to your invoice. |
name | string | The name of the invoice (product or service) to pay. |
description | string | A brief description of the invoice. |
active | boolean | Indicates whether the invoice is active. |
status | integer | The status of invoice. [0] pending | [1] paid | [-1] expired |
status_text | string | Textual representation of the invoice status. |
created_at | integer | Timestamp of when the invoice was created. |
due_by | integer | Timestamp of when the invoice is due, if applicable. |
deleted_at | integer | Timestamp of when the invoice was deleted, if applicable. |
link | string | URL link to the invoice. |
amount.amount | string | The total amount of the invoice. |
amount.currency | string | The currency of the invoice amount. |
amount.localized | string | The localized representation of the invoice amount. |
Request
Endpoint: https://api.youcanpay.com/invoices/{invoice_id}
Method: GET
bash
$ curl --location -g --request GET 'https://api.youcanpay.com/invoices/inv_028ef20c-5065-4515-a0d6-a1c17ff0d53e' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_TOKEN_eyJpc3...'Response
json
{
"data": {
"object": "invoice",
"id": "inv_028ef20c-5065-4515-a0d6-a1c17ff0d53e",
"reference": "0000000016",
"name": "eee",
"description": "test test.",
"active": true,
"status": 0,
"status_text": "pending",
"created_at": 1706459720,
"due_by": null,
"deleted_at": null,
"link": "https://youcanpay.com/i/TwRLnwU",
"amount": {
"amount": "10000",
"currency": "MAD",
"localized": "MAD 100.00"
}
}
}