Accept a one-off payment
Guide
A complete server-side charge flow, from creating the customer to showing the tax invoice. Uses test mode - swap in sk_live_ and a real card flow when you're ready to go live.
1. Create a customer
curl -X POST https://api.ching.co.il/v1/customers \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Tal Levi",
"email": "tal@example.com"
}'2. Attach a card
In test mode you can skip the setup-session flow entirely:
curl -X POST https://api.ching.co.il/v1/payment_methods/test-card \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{ "customer": "cus_V8ltq1pK_MWH" }'In live mode, replace this step with a setup session so Ching collects the card on your behalf.
3. Run the charge
curl -X POST https://api.ching.co.il/v1/charges \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{
"customer": "cus_V8ltq1pK_MWH",
"payment_method": "pm_WMc9X22NT1af",
"amount": 9900,
"description": "One-off order #1234"
}'The response contains the charge status and the id of the tax invoice Ching issues on your behalf:
{
"success": true,
"data": {
"id": "ch_9mTPfRSDmEOU",
"status": "succeeded",
"amount": 9900,
"currency": "ils",
"document": "doc_R0i70cuPK_yO"
}
}4. Send the receipt (optional)
Fetch the document to get its PDF URL and include it in your own order confirmation email:
curl https://api.ching.co.il/v1/documents/doc_R0i70cuPK_yO \ -H "Authorization: Bearer sk_test_..."