Expansion

Expansion returns related objects in the same response, such as a payment’s customer and payment method, instead of their IDs. Each endpoint that supports it lists the fields it can expand under its expand parameter, including creates and updates such as creating a payment.

A field set to true is expanded. An object in place of true also expands fields of the expanded object, such as payment_method: { customer: true }.

expand is a query parameter on every request, including POST and PATCH. Over HTTP, its value is URL-encoded JSON. The SDKs take it as an object.

curl -G https://api.biaspay.com/v1/payments/pay_lUY2g0TuPzN9qi4couahd3 \
    -H "Authorization: Bearer YOUR_API_KEY" \
    --data-urlencode 'expand={"customer":true,"payment_method":{"customer":true}}'

Expandable lists, such as an invoice’s payments, are null unless expanded.

Example

Click on a value to see it expanded in the response.

Request

const payment = await bias.payments.get("pay_lUY2g0TuPzN9qi4couahd3", {
    expand: {
    }
})

Response

{
  "object": "payment",
  "live": true,
  "id": "pay_lUY2g0TuPzN9qi4couahd3",
  "created_at": 1750000000000,
  "amount": 1000,
  "amount_capturable": 0,
  "amount_received": 1000,
  "amount_refunded": 0,
  "fees": {
    "interchange": 28,
    "chargeback": 0,
    "platform": 13,
    "total": 41
  },
  "capture_method": "automatic",
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "description": "Payment for order 123",
  "dispute": null,
  "invoice": null,
  "mandate": null,
  "off_session": false,
  "recurring": false,
  "ach_return": null,
  "metadata": {},
  "payment_error": null,
  "payment_method": "pm_VQ9SaYquIZTG2l0uRsmUr4",
  "session": null,
  "statement_descriptor": null,
  "status": "succeeded"
}