Refunds

Refund objects allow you to refund part or all of a settled payment. Funds are refunded to the credit or debit card that was initially charged.

The Refund object

Name
object
Type
"refund",
Description
Literal representing the object’s type.
Name
id
Type
string,
Description
Unique identifier for the object.
Name
live
Type
boolean,
Description
Has the value true if the object exists in a production environment or the value false if the object exists in a sandbox environment.
Name
created_at
Type
integer,
Description
Time at which the object was created. Measured in milliseconds since the Unix epoch.
Name
amount
Type
integer,
Description
The amount refunded.
Name
failed_reason
Type
string or null,
Description
If status is failed, contains a message explaining why the refund failed.
Name
payment
Type
string or Payment,
Description
Expandable. The payment being refunded.
Child properties
Name
status
Type
enum,
Description
The status of the refund.
Array item properties

The Refund object

{
  "object": "refund",
  "id": "re_3UgC74NSEMIWiFK5s3tZ82",
  "live": false,
  "created_at": 1750000000000,
  "amount": 1000,
  "failed_reason": null,
  "payment": "pay_lUY2g0TuPzN9qi4couahd3",
  "status": "succeeded"
}

Get a refund

Retrieve a refund by its ID.

Optional parameters

Name
expand
Type
empty object,
Description
Optional object that allows you to expand certain ID fields to include related resources.
Child properties

Returns

Returns the refund object.

Retrieve a refund

const refund = await bias.refunds.get("id");

Response example

{
  "object": "refund",
  "id": "re_3UgC74NSEMIWiFK5s3tZ82",
  "live": false,
  "created_at": 1750000000000,
  "amount": 1000,
  "failed_reason": null,
  "payment": "pay_lUY2g0TuPzN9qi4couahd3",
  "status": "succeeded"
}

List all refunds

Retrieve a paginated list of refunds.

Optional parameters

Name
expand
Type
empty object,
Description
Optional object that allows you to expand certain ID fields to include related resources.
Child properties
Name
ending_before
Type
string,
Description
A cursor for use in pagination. ending_before is an object ID that results will end before. Used to move backward through the list.
Name
starting_after
Type
string,
Description
A cursor for use in pagination. starting_after is an object ID that results will start after. Used to move forward through the list.
Name
limit
Type
number, at least 1, at most 1000, default is 50
Description
Maximum number of objects to return.
Name
filters
Type
,
Description
Filters to apply to the list. Combine multiple conditions with and and or.
Child properties

Returns

Returns a list of refund objects.

List all refunds

const refund = await bias.refunds.list();

Response example

{
  "object": "list",
  "items": [
    {
      "object": "refund",
      "id": "re_3UgC74NSEMIWiFK5s3tZ82",
      "live": false,
      "created_at": 1750000000000,
      "amount": 1000,
      "failed_reason": null,
      "payment": "pay_lUY2g0TuPzN9qi4couahd3",
      "status": "succeeded"
    }
  ],
  "has_more": false
}

Create a refund

Issue a refund for a succeeded payment. Multiple refunds can be issued against a single payment, provided there are sufficient funds available.

Required parameters

Name
payment
Type
string,
Description
The payment to refund. Must have a status of succeeded.

Optional parameters

Name
amount
Type
integer,
Description
The amount to refund. Defaults to the full amount of the payment if omitted. Must be less than or equal to the payment’s amount_refunded subtracted from the payment’s amount_received.

Returns

Returns the refund object.

Create a refund

const refund = await bias.refunds.create();

Response example

{
  "object": "refund",
  "id": "re_3UgC74NSEMIWiFK5s3tZ82",
  "live": false,
  "created_at": 1750000000000,
  "amount": 1000,
  "failed_reason": null,
  "payment": "pay_lUY2g0TuPzN9qi4couahd3",
  "status": "succeeded"
}