Complete guide to processing card payments using saved payment methods
save_card_and_make_default: true
.
save_card_and_make_default: true
Status | Description | Triggers |
---|---|---|
INITIATED | Payment record created, validation pending | Initial payment creation |
PROCESSING | Payment intent created and being processed | Stripe payment intent confirmation |
SUCCEEDED | Payment completed successfully | Successful charge confirmation |
FAILED | Payment attempt failed | Stripe payment failure or validation error |
REFUNDED | Payment was refunded | Manual refund processing |
POST /api/v1/payments
Headers:
Field | Type | Required | Description |
---|---|---|---|
destination_type | string | ✅ | Must be "INVOICE" |
destination_id | string | ✅ | Valid invoice ID |
payment_method_type | string | ✅ | Must be "CARD" |
payment_gateway | string | ✅ | Must be "stripe" |
amount | decimal | ✅ | Payment amount (must match invoice) |
currency | string | ✅ | Valid currency code |
process_payment | boolean | ✅ | Set to true to process immediately |
Field | Type | Required | Description |
---|---|---|---|
payment_method_id | string | ❌ | Specific payment method ID (uses default if empty) |
metadata | object | ❌ | Additional payment metadata |
payment_method_id
provided: Uses the customer’s default payment methodpayment_method_id
provided: Uses the specified payment method for this paymentconfirm: true
)true
for saved payment methodsError Code | Cause | Resolution |
---|---|---|
no_default_payment_method | Customer has no default payment method | Create payment link with save_card_and_make_default: true |
card_declined | Card was declined by issuer | Customer should contact their bank |
insufficient_funds | Insufficient funds on card | Customer should use different payment method |
authentication_required | 3D Secure authentication needed | Use payment link flow for authentication |
expired_card | Card has expired | Customer needs to update payment method |
Note: All card payment errors follow this standardized format for consistent error handling.
FAILED
save_card_and_make_default: true
save_card_and_make_default: true
Scenario | Test Card | Expected Result |
---|---|---|
Successful Payment | 4242424242424242 | Payment succeeds |
Declined Card | 4000000000000002 | Payment fails with decline |
Insufficient Funds | 4000000000009995 | Payment fails with insufficient funds |
Authentication Required | 4000002760003184 | Payment fails, requires payment link |