Payment Methods
Payment methods represent a customer's stored payment instruments (currently cards via EPD Gateway vault).
Each customer can have multiple payment methods. One is always designated as the default, which is used for new subscriptions and orders when no specific method is provided.
Important: Payment methods are created by providing a
billing_idfrom the EPD Gateway payment vault. You must first vault the card through EPD Gateway's client-side SDK, then attach it to a customer via this API.
/customers/{id}/payment_methods Add a payment method
Attaches a payment method to a customer using a billing_id from the EPD Gateway payment vault. The card details are fetched from EPD Gateway and stored securely.
How It Works
- Vault the card through EPD Gateway's client-side SDK (Collect.js or similar)
- Pass the resulting
billing_idto this endpoint - EPD fetches the card details from EPD Gateway and creates the payment method
Options
| Parameter | Default | Description |
|---|---|---|
set_as_default |
false |
Make this the customer's default payment method |
update_subscriptions |
false |
Update all active subscriptions to use this card |
Tip: Set both
set_as_default: trueandupdate_subscriptions: truewhen replacing an expired card.
Sandbox Testing
In sandbox mode, pass a test card token (e.g. card_visa, card_insufficient_funds) as the billing_id to add a simulated payment method — no card vaulting required. See the Testing Guide for all available tokens.
Path parameters
string"550e8400-e29b-41d4-a716-446655440000"Header parameters
string"2026-02-11"string (uuid)"550e8400-e29b-41d4-a716-446655440000"Request body required
string"987654"booleantruebooleanfalseCode samples
curl -X POST https://api.epd.com/v1/customers/550e8400-e29b-41d4-a716-446655440000/payment_methods \
-H "Authorization: Bearer epd_test_sk_xxxx" \
-H "Content-Type: application/json" \
-H "EPD-Version: 2026-02-11" \
-d '{
"billing_id": "987654",
"set_as_default": true,
"update_subscriptions": true
}' const response = await fetch(
'https://api.epd.com/v1/customers/550e8400-e29b-41d4-a716-446655440000/payment_methods',
{
method: 'POST',
headers: {
'Authorization': 'Bearer epd_test_sk_xxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
billing_id: '987654',
set_as_default: true,
}),
}
);
const pm = await response.json();
console.log(pm.id); // 6ba7b815-9dad-11d1-80b4-00c04fd430c8
console.log(pm.card.last4); // "4242" Responses
string"6ba7b815-9dad-11d1-80b4-00c04fd430c8"enumcardobjectstring"visa"string"4242"string"12/2025"string"550e8400-e29b-41d4-a716-446655440000"booleantruestring (date-time)"2024-01-15T10:30:00.000Z"objectenuminvalid_request_errorauthentication_errorauthorization_errorrate_limit_erroridempotency_errorprocessing_errorwebhook_errorstring"validation_error"string"Request validation failed"string"email"string"req_a1b2c3d4e5f67890abcdef0123456789"array[object]objectenuminvalid_request_errorauthentication_errorauthorization_errorrate_limit_erroridempotency_errorprocessing_errorwebhook_errorstring"validation_error"string"Request validation failed"string"email"string"req_a1b2c3d4e5f67890abcdef0123456789"array[object]objectenuminvalid_request_errorauthentication_errorauthorization_errorrate_limit_erroridempotency_errorprocessing_errorwebhook_errorstring"validation_error"string"Request validation failed"string"email"string"req_a1b2c3d4e5f67890abcdef0123456789"array[object]/customers/{id}/payment_methods/{pm_id} Delete a payment method
Removes a payment method from a customer. If it's the default or used by active subscriptions, a replacement must be provided.
Path parameters
string"550e8400-e29b-41d4-a716-446655440000"string"6ba7b815-9dad-11d1-80b4-00c04fd430c8"Header parameters
string"2026-02-11"string (uuid)"550e8400-e29b-41d4-a716-446655440000"Request body
string"6ba7b815-9dad-11d1-80b4-00c04fd430d1"Responses
string"6ba7b815-9dad-11d1-80b4-00c04fd430c8"truestring"Payment method successfully deleted."objectenuminvalid_request_errorauthentication_errorauthorization_errorrate_limit_erroridempotency_errorprocessing_errorwebhook_errorstring"validation_error"string"Request validation failed"string"email"string"req_a1b2c3d4e5f67890abcdef0123456789"array[object]objectenuminvalid_request_errorauthentication_errorauthorization_errorrate_limit_erroridempotency_errorprocessing_errorwebhook_errorstring"validation_error"string"Request validation failed"string"email"string"req_a1b2c3d4e5f67890abcdef0123456789"array[object]objectenuminvalid_request_errorauthentication_errorauthorization_errorrate_limit_erroridempotency_errorprocessing_errorwebhook_errorstring"validation_error"string"Request validation failed"string"email"string"req_a1b2c3d4e5f67890abcdef0123456789"array[object]