Save a card for later

Guide

Use a setup session to collect a card without your backend ever touching card data. Ching hosts the card-entry UI, runs 3DS on live mode, and sends the customer back to a URL you control.

1. Create a setup session

curl -X POST https://api.ching.co.il/v1/setup_sessions \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "customer": "cus_V8ltq1pK_MWH",
    "success_url": "https://app.example.com/billing/done",
    "cancel_url": "https://app.example.com/billing"
  }'

Redirect the customer to the url on the response.

2. Wait for the session to complete

Two options:

  • Subscribe to the setup_session.succeeded webhook (recommended - no polling, no missed races).
  • Poll GET /v1/setup_sessions/:id until status becomes succeeded.

3. Charge or subscribe

Once succeeded, the customer has a new active payment method. Look it up via GET /v1/customers/:id/payment_methods and use it in a charge or a subscription.

Tip: If the customer detaches this card later, you can always fetch detached cards from /v1/customers/:id/payment_methods/inactive.