Subscriptions
Subscriptions renew a customer on a recurring price. Ching handles the first charge, the renewal cron, retries on failure, and document issuance.
Use cases: Build SaaS billing, offer yearly plans, or run memberships with free trials.
POST
/v1/subscriptionsCreate a subscription and charge the first period immediately (unless the price has a trial, in which case the first charge runs at trial end).
If the first charge fails in live mode, the response is 402 with error.code CHARGE_FAILED and no subscription is created.
Body Parameters
| Name | Type | Description | |
|---|---|---|---|
customer | string | required | The customer id. |
payment_method | string | required | Active payment method id to charge on each renewal. |
price | string | required | A recurring price id. Determines amount and renewal cadence. |
metadata | object | Set of key-value pairs you can attach to the object for your own use. Returned as-is on retrieval. |
Request
curl -X POST "https://api.ching.co.il/v1/subscriptions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customer": "example_customer",
"payment_method": "example_payment_method",
"price": "example_price",
"metadata": {}
}'Response
Response
{
"success": true,
"data": {
"id": "sub_hXUPYOnvxp-q",
"object": "subscription",
"customer": "cus_V8ltq1pK_MWH",
"default_payment_method": "pm_WMc9X22NT1af",
"status": "active",
"currency": "ils",
"items": [
{
"id": "si_E4TEG8TRMHp-",
"price": "price_QA8qF3B3VIqE",
"quantity": 1
}
],
"billing_cycle_anchor": "2026-04-19T09:16:40.000Z",
"current_period_start": "2026-04-19T09:16:40.000Z",
"current_period_end": "2026-05-19T09:16:40.000Z",
"cancel_at_period_end": false,
"metadata": {},
"livemode": false,
"created": "2026-04-19T09:16:40.000Z"
}
}GET
/v1/subscriptionsList the 100 most recent subscriptions, newest first. Line items are omitted here - fetch the full subscription to see them.
Request
curl -X GET "https://api.ching.co.il/v1/subscriptions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Response
Response
{
"success": true,
"data": [
{
"id": "sub_hXUPYOnvxp-q",
"object": "subscription",
"customer": "cus_V8ltq1pK_MWH",
"default_payment_method": "pm_WMc9X22NT1af",
"status": "active",
"currency": "ils",
"items": [],
"billing_cycle_anchor": "2026-04-19T09:16:40.000Z",
"current_period_start": "2026-04-19T09:16:40.000Z",
"current_period_end": "2026-05-19T09:16:40.000Z",
"cancel_at_period_end": false,
"metadata": {},
"livemode": false,
"created": "2026-04-19T09:16:40.000Z"
}
]
}GET
/v1/subscriptions/:idRetrieve a subscription by its id, including expanded items.
Path Parameters
| Name | Type | Description | |
|---|---|---|---|
id | string | required | The subscription id. |
Request
curl -X GET "https://api.ching.co.il/v1/subscriptions/:id" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Response
Response
{
"success": true,
"data": {
"id": "sub_hXUPYOnvxp-q",
"object": "subscription",
"customer": "cus_V8ltq1pK_MWH",
"default_payment_method": "pm_WMc9X22NT1af",
"status": "active",
"currency": "ils",
"items": [
{
"id": "si_E4TEG8TRMHp-",
"price": "price_QA8qF3B3VIqE",
"quantity": 1
}
],
"billing_cycle_anchor": "2026-04-19T09:16:40.000Z",
"current_period_start": "2026-04-19T09:16:40.000Z",
"current_period_end": "2026-05-19T09:16:40.000Z",
"cancel_at_period_end": false,
"metadata": {},
"livemode": false,
"created": "2026-04-19T09:16:40.000Z"
}
}POST
/v1/subscriptions/:id/cancelCancel a subscription immediately or at period end.
Path Parameters
| Name | Type | Description | |
|---|---|---|---|
id | string | required | The subscription id. |
Body Parameters
| Name | Type | Description | |
|---|---|---|---|
cancel_at_period_end | boolean | When true, the subscription stays active until the end of the current period and will not renew. When false or omitted, it is canceled immediately. |
Request
curl -X POST "https://api.ching.co.il/v1/subscriptions/:id/cancel" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"cancel_at_period_end": true
}'Response
Response
{
"success": true,
"data": {
"id": "sub_hXUPYOnvxp-q",
"status": "canceled",
"cancel_at_period_end": false
}
}