Skip to content

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

ParameterTypeDescription
idstringThe object's unique identifier.
referencestringA reference to your invoice.
namestringThe name of the invoice (product or service) to pay.
descriptionstringA brief description of the invoice.
activebooleanIndicates whether the invoice is active.
statusintegerThe status of invoice. [0] pending | [1] paid | [-1] expired
status_textstringTextual representation of the invoice status.
created_atintegerTimestamp of when the invoice was created.
due_byintegerTimestamp of when the invoice is due, if applicable.
deleted_atintegerTimestamp of when the invoice was deleted, if applicable.
linkstringURL link to the invoice.
amount.amountstringThe total amount of the invoice.
amount.currencystringThe currency of the invoice amount.
amount.localizedstringThe 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"
    }
  }
}