# Manage payment methods (https://docs.billwave.example/subscriptions/wallet)

How to manage payment methods [#how-to-manage-payment-methods]

This guide shows how to let customers add a card on file, view their saved payment methods, and remove them. Payment methods are used for overage billing and credit pack purchases without requiring a new checkout.

List payment methods [#list-payment-methods]

Retrieve all saved payment methods for a customer:

```ts
const wallet = await billwave.wallet.list("user_123");

for (const method of wallet.methods) {
  console.log(method.cardBrand, `**** ${method.cardLast4}`, method.providerId);
}
```

Or use the shorthand:

```ts
const wallet = await billwave.wallet("user_123");
console.log("Has card:", wallet.hasCard);
```

Add a payment method [#add-a-payment-method]

Initiate card setup. The customer completes authorization on the provider's page.

```ts
const setup = await billwave.wallet.setup("user_123", {
  callbackUrl: "https://yourapp.com/billing?card=added",
});

if (setup.url) {
  // Redirect customer to authorize their card
  console.log(setup.url);
}
```

After the customer completes the flow, the provider sends a webhook and Billwave stores the payment method automatically.

Specify a provider [#specify-a-provider]

If your organization has multiple providers, specify which one:

```ts
const setup = await billwave.wallet.setup("user_123", {
  callbackUrl: "https://yourapp.com/billing",
  provider: "paystack",
});
```

Remove a payment method [#remove-a-payment-method]

```ts
const result = await billwave.wallet.remove("user_123", methodId);
console.log(result.success); // true
```

Why payment methods matter [#why-payment-methods-matter]

When a customer has a card on file:

* **Overage billing** charges are applied automatically at period end
* **Credit pack purchases** via `addon()` charge instantly without a checkout redirect
* **Trial conversions** bill the card when the trial ends

Without a card on file, these flows fall back to checkout redirects.