Skip to content

List All Transactions

Returns a paginated list of transaction objects related to the current authenticated account. The list is sorted, with the most recent transactions appearing first by default.

Required scope: view-transactions

Parameters

Filter and Sort Transactions

ParameterTypeDescription
sort_fieldstring optionalField you want to sort by. Defaults to created_at.
sort_orderstring optionalSorting order, asc or desc. Defaults to desc; any other value falls back to desc.
pageinteger optionalPage number. Defaults to 1.
limitinteger optionalPage size. Defaults to 10, capped at 50.
qstring optionalFree-text search term.
filtersarray optionalAn array of filter criteria where each entry has the following keys:
filters[].fieldstringField you want to filter by.
filters[].valuestringThe value to compare by.
filters[].operatorstringComparison operator. Accepted values: = (default), is, is_not, !=, <, <=, >, >=, in, like, not like.

Returns

Returns a paginated collection of transaction objects. If no transactions are found, returns an empty collection.

Request

Endpoint: https://youcanpay.com/api/v2/transactionsMethod: GET

bash
$ curl --location -g --request GET 'https://youcanpay.com/api/v2/transactions' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_TOKEN_eyJpc3...'

Request with Filters

bash
$ curl --location -g --request GET 'https://youcanpay.com/api/v2/transactions?sort_field=amount&sort_order=asc&filters[0][field]=amount&filters[0][value]=10000' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_TOKEN_eyJpc3...'

Response

json
{
  "object": "v2.transaction",
  "data": [
    {
      "object": "v2.transaction",
      "id": "10e7691c-14a2-4936-833b-ec154c817ce9",
      "status": "paid",
      "is_live_mode": false,
      "paid_at": "2024-01-29 10:31:39",
      "amount": {
        "amount": "100.00",
        "currency": "MAD",
        "localized": "MAD 100.00"
      },
      "fees": {
        "amount": "6.90",
        "currency": "MAD",
        "localized": "MAD 6.90"
      },
      "order_id": "inv_028ef20c-5065-4515-a0d6-a1c17ff0d53e",
      "customer_id": "38678dea-d23a-4388-bb78-648892bce85b",
      "customer_ip": "192.168.65.1",
      "payment_method": {
        "type": "credit_card",
        "id": "0fd9bb2c-f14b-411c-bc90-deb73ddaf9ff"
      },
      "is_fully_refunded": false,
      "amount_refunded": {
        "amount": "0.00",
        "currency": "MAD",
        "localized": "MAD 0.00"
      },
      "hold_released_at": null,
      "success_url": null,
      "error_url": null,
      "metadata": {
        "type": "youcan_pay.invoice"
      },
      "created_at": "2024-01-29 10:31:30"
    }
  ],
  "pagination": {
    "current_page": 1,
    "per_page": 10,
    "total": 6,
    "last_page": 1
  }
}

See the Transaction object for a description of each field.