Storing Payment Methods
This guide is for developers looking to store payment methods via API.
OverviewThis guide explains how to collect card and bank account details and attach them to a customer record for future use. By following these steps, developers can safely handle sensitive payment data while enabling future transactions such as subscriptions or one-time charges.
Prerequisites
Before you begin, make sure you have:
- A valid Bearer token — see API Authentication
- Access to the sandbox / test environment
- A customer record created and a customer_id from that customer
- A test card Test Cards
- A test bank account Test Bank Account
Having these in place ensures you can properly associate payment methods with a customer record.
Option 1: Storing a Card
Step 1: Tokenize a Card
To securely store card details, you must first tokenize the card using our Tokens API. Tokenization replaces raw card data with a secure token that can safely be stored and used for future transactions.
- To tokenize a card, see the API Reference here.
- What you get back: The API response includes a token id (e.g., "id": "mLY0rn8L5ql0w5rn"), which represents the customer’s card. This token id is required when attaching the payment method to a customer.
Tip: Be sure to use our test cards when working in the sandbox environment.
Step 2: Update Customer with Token
Update an existing customer record to securely attach the tokenized card, enabling it for future transactions without ever exposing or handling raw card details.
- To store a card to a customer record, see the API Reference here.
- What you get back: The API response includes the updated customer object, with an updated card object. This card object contains a card ID, which represents the stored payment method and can be used for future transactions.
Option 2: Bank Account
Step 1: Create and Store Bank Account
You can create and store a bank account on a customer record with a single API call. This allows you to securely save the customer’s ACH/bank details for future transactions or subscriptions.
- To create a bank account and store it to a customer record, see the API Reference here.
- What you get back: The API response will include a BankAccount object with a unique id (e.g., j4ELaekDLJak3JdD). This id represents the stored bank account and is can be used when creating an ACH charge.
Updated about 4 hours ago