Skip to content

The Transaction Object

Required scope: view-transactions

Attributes

ParameterTypeDescription
objectstringAlways v2.transaction.
idstringThe unique identifier for the transaction.
statusstringOne of paid, canceled, pending, refunded, failed, authorized.
is_live_modebooleanIntended to indicate whether the transaction ran in live mode.
paid_atstring|nullDate and time the transaction was paid.
amountobject|nullThe transaction amount, as a money object.
feesobject|nullThe fees charged on the transaction, as a money object.
order_idstring|nullThe identifier of the associated order or invoice.
customer_idstring|nullThe unique identifier of the customer involved in the transaction.
customer_ipstring|nullIP address of the customer.
payment_method.typestringType of the payment method used in the transaction.
payment_method.idstring|nullUnique identifier for the payment method used.
is_fully_refundedbooleanWhether the transaction has been fully refunded.
amount_refundedobject|nullAmount refunded so far, as a money object.
hold_released_atstring|nullDate and time the held funds were released, if applicable.
success_urlstring|nullRedirect URL used on successful payment.
error_urlstring|nullRedirect URL used on failed payment.
metadataobjectArbitrary metadata attached to the transaction.
created_atstring|nullDate and time the transaction was created.

Includes

Pass ?include= on the details endpoint below to embed related resources (list responses don't support include):

IncludeDescription
customerEmbeds the Customer object under a customer key.
refundsEmbeds an array of Refund objects under a refunds key, only populated if the transaction has been partially or fully refunded.

Request

Endpoint: https://youcanpay.com/api/v2/transactions/{transaction_id}Method: GET

bash
$ curl --location -g --request GET 'https://youcanpay.com/api/v2/transactions/0142cd46-5813-4c62-8fd3-081e4a9fb964' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_TOKEN_eyJpc3...'

Response

json
{
  "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.0.113",
  "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"
}

The Customer Object

ParameterTypeDescription
objectstringAlways v2.customer.
idstringThe object's unique identifier.
emailstring|nullThe customer's email address.
phonestring|nullThe customer's phone number.
full_namestring|nullThe customer's full name.
descriptionstring|nullA description of the customer.
address.countrystring|nullCountry code.
address.statestring|nullState/province.
address.citystring|nullCity.
address.line1string|nullStreet address.
address.postal_codestring|nullPostal/zip code.
metadataobjectArbitrary metadata attached to the customer.
created_atstring|nullDate and time the customer was created.
updated_atstring|nullDate and time the customer was last updated.