const { result, error } = await unprice.customers.getPaymentMethods({
  customerId: "cus_1234567890",
  provider: "stripe"
});

if (error) {
  // handle potential network or bad request error
  // a link to our docs will be in the `error.docs` field
  console.error(error.message);
  return;
}

console.log(result);
[
  {
    "id": "pm_1234567890",
    "name": "John Doe",
    "last4": "4242",
    "expMonth": 12,
    "expYear": 2024,
    "brand": "visa"
  }
]
const { result, error } = await unprice.customers.getPaymentMethods({
  customerId: "cus_1234567890",
  provider: "stripe"
});

if (error) {
  // handle potential network or bad request error
  // a link to our docs will be in the `error.docs` field
  console.error(error.message);
  return;
}

console.log(result);
[
  {
    "id": "pm_1234567890",
    "name": "John Doe",
    "last4": "4242",
    "expMonth": 12,
    "expYear": 2024,
    "brand": "visa"
  }
]

Request

customerId
string
required
The ID of the customer to get payment methods for
provider
string
required
The payment provider to get payment methods from

Response

[].id
string
required
The ID of the payment method
[].name
string
The name on the payment method
[].last4
string
The last 4 digits of the payment method
[].expMonth
number
The expiration month of the payment method
[].expYear
number
The expiration year of the payment method
[].brand
string
The brand of the payment method (e.g., visa, mastercard)