--- url: https://docs.youcan.shop/apps/billing/charges/cancel.md --- # Cancel a Recurring Charge Cancels an active recurring charge owned by your application. Cancellation is **at period end**: the seller 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_`. | ## Behavior * `status` stays `active` and `period_ends_at` does not change. * `canceled_at` is set to the end of the current period. * The scheduled job sets `status` to `canceled` when `period_ends_at` is 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. ::: ## Response ```json [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`](/apps/billing/charges/recurring#apprecurring-charge-object) 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. | ## Webhooks `app.charge_updated` fires twice for an at-period-end cancellation: 1. On cancellation: `status: "active"`, a future `period_ends_at`, and `canceled_at` set. 2. 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. To stop a renewal as soon as a seller uninstalls, call this endpoint from your [`app.uninstalled`](/store-admin/resthooks/subscribe) webhook handler.