Cancel a Recurring Charge
Cancels an active recurring charge owned by your application. Cancellation is at period end: the store is not billed for the next renewal, but the charge stays usable until the current billing period ends.
Endpoint: https://api.youcan.shop/billing/apps/charges/recurring/{id}
Method: DELETE
Path parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The recurring charge ID, prefixed with arch_. |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
prorate | boolean | No | Cancel the charge at once and credit the store for the unused days of the current period. Defaults to false. |
Behavior
statusstaysactiveandperiod_ends_atdoes not change.canceled_atis set to the end of the current period.- The scheduled job sets
statustocanceledwhenperiod_ends_atis reached. - The charge does not renew after the current period.
Warning
The response returns status: "active" right after you cancel. The status becomes canceled at period_ends_at. Use the canceled_at field to detect a charge that is scheduled for cancellation.
With prorate
statusis set tocanceledat once.- The store is credited for the full days left in the current period, at the charge price. The store is never credited more than it paid your app for the period, after earlier credits.
- The credit is deducted from your payouts, less the platform fee on the credit.
- During a trial, nothing was paid, so no credit is given.
Response
[200]
{
"type": "recurring",
"id": "arch_01234567890abcdef",
"store_id": "...",
"name": "Monthly Subscription",
"status": "active",
"plans": [
{
"interval": 30,
"price": {
"amount": "19.99",
"currency": "USD"
}
}
],
"test": false,
"trial_days": 7,
"created_at": 1640995200,
"period_ends_at": 1643673600,
"canceled_at": 1643673600
}Returns the updated AppRecurringCharge object.
Errors
| Status | Reason |
|---|---|
404 | The charge does not exist, or it does not belong to your app and the current store. |
422 | The charge is not active, so it cannot be canceled. |
422 | The charge is already scheduled for cancellation and prorate is not set. |
Webhooks
app.charge_updated fires twice for an at-period-end cancellation:
- On cancellation:
status: "active", a futureperiod_ends_at, andcanceled_atset. - At period end:
status: "canceled".
Canceling on uninstall
Uninstalling an app schedules its active recurring charges for cancellation at period end, the same behavior as this endpoint. If the merchant installs the app on the store again before the period ends and approves a new charge, the rest of the paid period is counted toward it, the same as a plan change. Deferred and frozen charges are canceled at once, and pending charges expire.