Payment methods

The payment method object represents a customer’s payment instrument. Payment methods are automatically created when a payment is created. Create a re-usable payment method by using the payment create resource with payment_method.setup_future_usage.

The PaymentMethod object

Name
object
Type
"payment_method",
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
active
Type
boolean,
Description
Whether the payment method can be used for new payments. Has a value of false if the payment method has been deactivated or if it was created without setup_future_usage.
Name
billing_details
Type
empty object,
Description
Billing information for the payment method.
Child properties
Name
card
Type
empty object or null,
Description
The payment method’s card details.
Child properties
Name
customer
Type
string or Customer or null,
Description
Expandable. The customer this payment method is attached to.
Name
type
Type
enum,
Description
The type of the payment method.
Array item properties

The PaymentMethod object

{
  "object": "payment_method",
  "id": "pm_VQ9SaYquIZTG2l0uRsmUr4",
  "live": false,
  "created_at": 1750000000000,
  "active": true,
  "billing_details": {
    "address": {
      "city": "Los Angeles",
      "country": "US",
      "line1": "123 Main Street",
      "line2": null,
      "postal_code": "90001",
      "state": "CA"
    },
    "name": "John Doe"
  },
  "card": {
    "object": "card",
    "live": false,
    "id": "card_inJ1dWsOEGezQOWd69qUW5",
    "created_at": 1750000000000,
    "bin": "424242",
    "brand": "visa",
    "checks": {
      "address_line_1": "pass",
      "address_postal_code": "pass",
      "cvc": "pass"
    },
    "country": "US",
    "exp_month": 1,
    "exp_year": 2030,
    "funding": "credit",
    "issuer": "Wells Fargo",
    "last4": "4242"
  },
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "type": "card"
}

Get a payment method

Retrieve a payment method 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 payment method.

Retrieve a payment method

const paymentMethod = await bias.paymentMethods.get("id");

Response example

{
  "object": "payment_method",
  "id": "pm_VQ9SaYquIZTG2l0uRsmUr4",
  "live": false,
  "created_at": 1750000000000,
  "active": true,
  "billing_details": {
    "address": {
      "city": "Los Angeles",
      "country": "US",
      "line1": "123 Main Street",
      "line2": null,
      "postal_code": "90001",
      "state": "CA"
    },
    "name": "John Doe"
  },
  "card": {
    "object": "card",
    "live": false,
    "id": "card_inJ1dWsOEGezQOWd69qUW5",
    "created_at": 1750000000000,
    "bin": "424242",
    "brand": "visa",
    "checks": {
      "address_line_1": "pass",
      "address_postal_code": "pass",
      "cvc": "pass"
    },
    "country": "US",
    "exp_month": 1,
    "exp_year": 2030,
    "funding": "credit",
    "issuer": "Wells Fargo",
    "last4": "4242"
  },
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "type": "card"
}

List all payment methods

Retrieve a paginated list of payment methods.

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 payment methods.

List all payment methods

const paymentMethod = await bias.paymentMethods.list();

Response example

{
  "object": "list",
  "items": [
    {
      "object": "payment_method",
      "id": "pm_VQ9SaYquIZTG2l0uRsmUr4",
      "live": false,
      "created_at": 1750000000000,
      "active": true,
      "billing_details": {
        "address": {
          "city": "Los Angeles",
          "country": "US",
          "line1": "123 Main Street",
          "line2": null,
          "postal_code": "90001",
          "state": "CA"
        },
        "name": "John Doe"
      },
      "card": {
        "object": "card",
        "live": false,
        "id": "card_inJ1dWsOEGezQOWd69qUW5",
        "created_at": 1750000000000,
        "bin": "424242",
        "brand": "visa",
        "checks": {
          "address_line_1": "pass",
          "address_postal_code": "pass",
          "cvc": "pass"
        },
        "country": "US",
        "exp_month": 1,
        "exp_year": 2030,
        "funding": "credit",
        "issuer": "Wells Fargo",
        "last4": "4242"
      },
      "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
      "type": "card"
    }
  ],
  "has_more": false
}

Update a payment method

Update a payment method’s customer or billing details. Values of null will set the field to null. Omit a field to keep its current value.

Optional parameters

Name
billing_details
Type
empty object,
Description
Billing information for the payment method
Child properties
Name
customer
Type
string or null,
Description
The customer to associate with the payment method

Returns

Returns the updated payment method.

Update a payment method

const paymentMethod = await bias.paymentMethods.update("id", {
  billing_details: {
    address: {
      line1: "123 Main Street",
      city: "Los Angeles",
      state: "CA",
      postal_code: "90001"
    }
  }
});

Response example

{
  "object": "payment_method",
  "id": "pm_VQ9SaYquIZTG2l0uRsmUr4",
  "live": false,
  "created_at": 1750000000000,
  "active": true,
  "billing_details": {
    "address": {
      "city": "Los Angeles",
      "country": "US",
      "line1": "123 Main Street",
      "line2": null,
      "postal_code": "90001",
      "state": "CA"
    },
    "name": "John Doe"
  },
  "card": {
    "object": "card",
    "live": false,
    "id": "card_inJ1dWsOEGezQOWd69qUW5",
    "created_at": 1750000000000,
    "bin": "424242",
    "brand": "visa",
    "checks": {
      "address_line_1": "pass",
      "address_postal_code": "pass",
      "cvc": "pass"
    },
    "country": "US",
    "exp_month": 1,
    "exp_year": 2030,
    "funding": "credit",
    "issuer": "Wells Fargo",
    "last4": "4242"
  },
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "type": "card"
}

Deactivate a payment method

Render a payment method inactive, preventing it from being used in future transactions.

Returns

Returns the deactivated payment method.

Deactivate a payment method

const paymentMethod = await bias.paymentMethods.deactivate("id");

Response example

{
  "object": "payment_method",
  "id": "pm_VQ9SaYquIZTG2l0uRsmUr4",
  "live": false,
  "created_at": 1750000000000,
  "active": true,
  "billing_details": {
    "address": {
      "city": "Los Angeles",
      "country": "US",
      "line1": "123 Main Street",
      "line2": null,
      "postal_code": "90001",
      "state": "CA"
    },
    "name": "John Doe"
  },
  "card": {
    "object": "card",
    "live": false,
    "id": "card_inJ1dWsOEGezQOWd69qUW5",
    "created_at": 1750000000000,
    "bin": "424242",
    "brand": "visa",
    "checks": {
      "address_line_1": "pass",
      "address_postal_code": "pass",
      "cvc": "pass"
    },
    "country": "US",
    "exp_month": 1,
    "exp_year": 2030,
    "funding": "credit",
    "issuer": "Wells Fargo",
    "last4": "4242"
  },
  "customer": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
  "type": "card"
}