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
The ID of the customer to get payment methods for
The payment provider to get payment methods from
Response
The ID of the payment method
The name on the payment method
The last 4 digits of the payment method
The expiration month of the payment method
The expiration year of the payment method
The brand of the payment method (e.g., visa, mastercard)