Add Payment Method
Form for adding a new payment method (credit card or bank account).
Usage
const addPayment = client.components.addPaymentMethod({
containerId: 'add-payment',
customerId: 'cus_xxx',
defaultType: 'CARD',
onSuccess: (paymentMethod) => {
console.log('Added:', paymentMethod.id);
},
onCancel: () => {
console.log('Cancelled');
},
});Configuration
AddPaymentMethodConfig
containerId
string
Yes
ID of the container element
customerId
string
Yes
Customer ID to add payment method for
defaultType
'CARD' | 'ACH'
No
Default tab to show
currency
'usd' | 'cad'
No
Currency context
theme
ThemeConfig
No
Custom theme configuration
onSuccess
(pm: PaymentMethod) => void
No
Called when payment method is created
onCancel
() => void
No
Called when "Cancel" is clicked
onError
(error: Error) => void
No
Called on errors
Card Form
The card form uses Evervault for PCI-compliant card collection. Your application never touches raw card data.
Fields collected:
Card number
Expiration date (MM/YY)
Cardholder name
Billing address (street, city, state, postal code, country)
Bank Account Form (ACH)
The ACH form uses Plaid for secure bank account linking.
Process:
User clicks "Connect Bank Account"
Plaid Link opens in a modal
User selects their bank and authenticates
Account details are securely captured
Example
Security
PCI Compliance
Card data is collected directly by Evervault and never touches your servers. This keeps your application out of PCI scope.
Last updated
Was this helpful?
