Complete guide to creating payment links and handling the Stripe checkout flow
Status | Description | Triggers |
---|---|---|
INITIATED | Payment record created, Stripe session not yet created | Initial payment creation |
PENDING | Stripe checkout session created successfully | Successful Stripe API call |
PROCESSING | Payment is being processed | Temporary status during updates |
SUCCEEDED | Payment completed successfully | Stripe webhook: checkout.session.completed |
FAILED | Payment attempt failed | Stripe webhooks: checkout.session.expired , payment_intent.payment_failed |
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 "payment_link" |
payment_gateway | string | ✅ | Must be "stripe" |
amount | string | ✅ | Payment amount (must match invoice) |
currency | string | ✅ | Valid currency code |
process_payment | boolean | ✅ | Set to true to create Stripe session |
save_card_and_make_default | boolean | ❌ | Save card for future payments (default: false) |
save_card_and_make_default
is set to true
:
setup_future_usage: "off_session"
CARD
payment method type paymentscheckout.session.completed
webhook:
save_card_and_make_default
from payment metadataSUCCEEDED
Error | Cause | Resolution |
---|---|---|
”Customer not found in Stripe” | Customer not synced | Sync customer to Stripe first |
”Invalid invoice amount” | Amount mismatch | Ensure amount matches invoice |
”Invoice already paid” | Invoice status issue | Check invoice payment status |
”Stripe session creation failed” | API error | Check Stripe connection |
FAILED
Card Number | Description |
---|---|
4242424242424242 | Successful payment |
4000000000000002 | Card declined |
4000000000009995 | Insufficient funds |
4000000000009987 | Expired card |
save_card_and_make_default: true
enable future card payments:
CARD
payment method typesave_card_and_make_default: true
for returning customersPOST /api/v1/webhooks/stripe/{tenant_id}/{environment_id}
- Stripe webhook handler