Guides
Manage payment methods
Add, list, and remove cards using the wallet API
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
Retrieve all saved payment methods for a customer:
const wallet = await owo.wallet.list("user_123");
for (const method of wallet.methods) {
console.log(method.cardBrand, `**** ${method.cardLast4}`, method.providerId);
}Or use the shorthand:
const wallet = await owo.wallet("user_123");
console.log("Has card:", wallet.hasCard);Add a payment method
Initiate card setup. The customer completes authorization on the provider's page.
const setup = await owo.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 Owostack stores the payment method automatically.
Specify a provider
If your organization has multiple providers, specify which one:
const setup = await owo.wallet.setup("user_123", {
callbackUrl: "https://yourapp.com/billing",
provider: "paystack",
});Remove a payment method
const result = await owo.wallet.remove("user_123", methodId);
console.log(result.success); // trueWhy 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.