ShoppingateShoppingateDevelopers
shoppinggate.app ↗
Documentation
  • What is a Mini App
  • Why Mini Apps
  • API integration
  • SDK
  • Webview
  • Mini App architecture
  • Getting started
  • Choosing your path
  • Introduction
    • Introduction
    • Sign up & login
    • Dashboard & analytics
    • Mini-Programs
    • Submit & publish a version
    • App Binding
    • Privacy Settings
    • Allowed URL
    • Users & roles
    • Introduction
    • Become a Mini-App vendor
    • API keys
    • My Mini-Apps
    • Orders
    • Webhook
    • Deep-link config
    • Introduction
    • Install & log in
    • Create a project
    • The workspace
    • Preview & upload
  • Introduction
  • Configuration
  • Lifecycle
  • Routing & query
  • Host functions
  • orderPayment
  • Permissions
  • User info
  • Introduction
  • Configuration
  • SDK
  • Lifecycle
  • Routing & query
  • Host functions
  • orderPayment
  • Permissions
  • User info
  • Web app and shell calls
  • Look and feel
  • Overview
    • Verify user
    • Create order
    • Get order
    • Update order status
    • Charge an order
    • Send a notification
  • Subscriptions
    • Create a subscription
    • List subscriptions
    • Get a subscription
    • Update a subscription
    • Reschedule next charge
    • Change plan (upgrade)
    • Cancel a subscription
  • Webhooks
Subscriptions

Cancel a subscription

Cancel at period end by default, or immediately with { immediate: true }. No refund of the current period.

POST/s2s/v1/subscriptions/{ref}/cancel
What it does

Cancel a subscription. By default it cancels at period end — the user keeps access until current_period_end, then it moves to cancelled and stops renewing. Send { "immediate": true } to cancel right now.

Cancelling does not refund the current period. A subscription already in a terminal state (cancelled / expired) is rejected.

Path
refRequired
The provider_subscription_ref (path).
immediate
true cancels immediately; omit or false schedules the cancel for period end.
Request schema
{
  "immediate": <boolean>    // optional — default false (cancel at period end)
}
Response
data.statusstring
cancelled on an immediate cancel; unchanged on an at-period-end cancel (watch cancel_at_period_end instead).
data.cancel_at_period_endboolean
true after a non-immediate cancel — the subscription stops at current_period_end. Clear it with an update if the user changes their mind.
messagestring
Reads "Subscription cancelled" on immediate, "…will cancel at period end" otherwise — do not branch on it; use the fields above.
error_code (on 4xx)string
SUBSCRIPTION_NOT_FOUND (404), SUBSCRIPTION_TERMINAL (422).
Response schema
// 200 OK — immediate: status is "cancelled"
//          at period end: status unchanged, cancel_at_period_end = true
{
  "status":  true,
  "data":    {
    "subscription_uuid":        "0193c7f0-2a1b-7de4-9c0a-6b5f1e2d3c44",
    "provider_subscription_ref": "SUB-GOLD-9b3f12",
    "user_id":                  6093,
    "status":                   "active",      // incomplete | active | past_due | cancelled | expired
    "plan_code":                "gold_monthly",
    "plan_name_en":             "Gold — Monthly",
    "plan_name_ar":             "الذهبية — شهري",
    "amount":                   "29.00",
    "currency":                 "SAR",
    "interval":                 "month",        // day | week | month | year
    "interval_count":           1,
    "auto_renew":               true,
    "cancel_at_period_end":     false,
    "payment_method":           "card",         // null until the user activates
    "current_period_start":     "2026-11-09T12:00:00.000Z",
    "current_period_end":       "2026-12-09T12:00:00.000Z",
    "next_charge_at":           "2026-12-09T12:00:00.000Z",
    "started_at":               "2026-11-09T12:00:00.000Z",
    "activated_at":             "2026-11-09T12:00:30.000Z",
    "cancelled_at":             null,
    "plan_metadata":            { "tier": "gold" },
    "metadata":                 { "crm_id": "C-4471" },
    "created_at":               "2026-11-09T11:59:40.000Z",
    "updated_at":               "2026-11-09T12:00:30.000Z"
  },
  "message": "Subscription cancelled"
}

// 404 SUBSCRIPTION_NOT_FOUND
// 422 SUBSCRIPTION_TERMINAL — already cancelled/expired
{
  "status":     false,
  "error_code": "SUBSCRIPTION_TERMINAL",
  "message":    "subscription is already cancelled"
}
Try it
Base URL
https://microservices.shoppinggate.app/mini-app-core/