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.

Required scope: view-invoices

Attributes

ParameterTypeDescription
objectstringAlways v2.invoice.
idstringThe object's unique identifier.
referencestring|nullA reference to your invoice.
namestringThe name of the invoice (product or service) to pay.
descriptionstring|nullA brief description of the invoice.
activebooleanWhether the invoice is active.
statusstringOne of pending, paid, expired.
amountobject|nullThe invoice amount, as a money object.
linkstringURL link to the invoice.
due_bystring|nullWhen the invoice is due.
created_atstring|nullWhen the invoice was created.
deleted_atstring|nullWhen 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
}