Self-serve subscription cancel
Give your customers a "Cancel my subscription" button without exposing your secret key or building a custom auth flow.
Customers should be able to cancel their subscription themselves. It's the friendliest thing to do, and it cuts down support volume. Strimz doesn't ship a hosted "Cancel my subscription" page because cancellation almost always involves business logic that's specific to your product. But the API call is one line; building the surrounding UI is straightforward.
Here's the pattern that works.
The shape
The customer is already authenticated in your app. They have a session cookie, a JWT, whatever you use. From their billing page, they click "Cancel subscription." Your server makes the Strimz API call. The Strimz secret key never reaches the browser.
The Strimz API key stays on your server. The customer's auth happens however you already auth them. You don't need a separate Strimz-specific login.
Setup
You need the customer's Strimz subscription id. This was given to you in the subscription.created webhook when they signed up; you stored it on their account row.
When subscription.created fires:
Now your server can look up the subscription id from the authenticated user.
The cancel route
The button
The page that uses it:
That's the whole flow. Strimz stops charging as soon as the cancel call returns. Keeping access until currentPeriodEndAt is your product's choice, since the customer already paid for that period.
The API also queues an on-chain cancel. It works with the subscriptions contract from the next testnet redeploy (#142). On the current deployment it reverts, so the contract still lists the subscription as live. Strimz does not charge it.
When the cancellation lands
subscription.cancelled fires during the cancel call, with data.status: 'cancelled'. You already have the details from the API response, but update from the webhook too so every path ends in the same state.
No later event fires when the period ends. Revoke access when accessUntil passes, from your own job or on the next request.
A customer can also cancel from their wallet by calling cancel() on the subscriptions contract. Strimz marks the subscription cancelled, but no webhook fires for that path today, so check subscriptions.retrieve if your records and Strimz disagree.
Why this pattern
The Strimz API key never touches the browser. The customer's auth uses your existing system; you don't need to give them a Strimz-specific login. The cancellation is one API call from your server; your server controls the policy (do they need to confirm? do they get a refund? do they see a "are you sure?" page?).
We don't ship a Strimz-hosted cancel page because the right cancellation policy varies. Some products refund unused time; some don't. Some run a win-back flow; some let customers leave immediately. Building one cancel UX into Strimz would be wrong for most merchants. The primitive is what you need; the policy is yours to compose.

