Skip to main content

Stored Payment Methods

Enable customers to save payment methods for faster checkout.

Overview

Stored payment methods allow customers to:

  • Save credit/debit cards
  • Reuse payment information
  • Enable faster checkout
  • Set up recurring payments

Implementation

Enable Storage

When creating a payment session, set storePaymentMethod: true:

const session = await sdk.transactions.clientSessions.payments.start({
transactionProvider: TRANSACTION_PROVIDER.NUVEI,
data: {
// ... other fields
storePaymentMethod: true, // Enable storing payment method
},
});

Add Payment Method Without Payment

You can also add a payment method without making a payment (for $0 authorization):

// Start add payment method session
const addPmSession = await sdk.transactions.clientSessions.paymentMethod.add.start({
transactionProvider: TRANSACTION_PROVIDER.NUVEI,
data: {
currency: CURRENCY.USD,
merchantInternalCustomerCode: 'customer-123',
merchantInternalTransactionCode: `add-pm-${Date.now()}`,
billing: {
billingEmail: 'john@example.com',
billingFirstName: 'John',
billingLastName: 'Doe',
billingAddressCountry: COUNTRY_ISO_2.US,
},
},
});

// After frontend processing, verify to get the stored payment method
const transaction = await sdk.transactions.clientSessions.paymentMethod.add.verify({
id: addPmSession.id,
});

console.log('Payment method stored:', transaction.paymentMethod?.id);

List Stored Methods

const methods = await sdk.paymentMethods.getMany({
merchantInternalCustomerCode: 'customer-123',
});

Use Stored Method

Charge using a stored payment method:

const transaction = await sdk.transactions.payments.paymentMethod.charge({
transactionProvider: TRANSACTION_PROVIDER.NUVEI,
data: {
amount: 2500n,
currency: CURRENCY.USD,
merchantCustomerPaymentMethodId: 'pm_123',
merchantInternalCustomerCode: 'customer-123',
merchantInternalTransactionCode: `txn-${Date.now()}`,
billing: {
billingEmail: 'john@example.com',
billingFirstName: 'John',
billingLastName: 'Doe',
billingAddressCountry: COUNTRY_ISO_2.US,
},
},
});

Use stored payment methods for:

  • Recurring payments
  • Subscription charges
  • Quick checkout

Security

Stored payment methods are:

  • Tokenized securely
  • PCI-compliant
  • Encrypted at rest