Cancel a Subscription
Overview
Cancel a Subscription to stop all future recurring charges. The subscription state will change to CANCELED and no additional payments will be collected.
Resource Access
- User Permissions: Admin users only
- Endpoint:
DELETE /subscriptions/\{subscription_id}
Arguments
| Parameter | Type | Required | Description |
|---|---|---|---|
| subscription_id | string | Yes (path) | The unique ID of the Subscription to cancel |
Example Request
curl -X DELETE \
'https://api.ahrvo.network/payments/na/subscriptions/SUBsubscription123' \
-u username:password \
-H 'Content-Type: application/json'
Example Response
HTTP/1.1 204 No Content
Additional Information
- HTTP 204 No Content: Success returns empty response
- No response body
- Subscription has been canceled
- State changed to CANCELED
- Immediate Cancellation: Effective immediately
- No future charges will occur
- Current billing period continues until end date
- No refund for partial period (unless manually applied)
- Cannot Be Undone: Cancellation is permanent
- Cannot reactivate canceled subscription
- Must create new subscription to restart
- Preserves cancellation for historical records
- Access Until Period End: Customer retains access
- Paid through current billing cycle
- Service continues until next_billing_date
- Example: Cancel Dec 10, next bill Jan 1
- Service continues through Dec 31
- No charge on Jan 1
- Use Cases:
- Customer Cancellation: Self-service cancellation
- Non-Payment: Cancel after repeated failed payments
- Terms Violation: Account suspension/termination
- Voluntary Churn: Customer no longer needs service
- Upgrade Path: Cancel basic, create pro subscription
- Best Practices:
- Survey Reason: Ask why customer canceling
- Improve retention
- Identify issues
- Offer alternatives
- Offer Alternatives: Before canceling
- Downgrade to cheaper plan
- Pause subscription (if supported)
- Apply discount/credit
- Confirm Action: Prevent accidental cancellations
- "Are you sure?" confirmation
- Explain what they'll lose
- Show access end date
- Send Confirmation: Email after cancellation
- Confirm cancellation
- State access end date
- Offer to reactivate
- Retention Offers: Save at-risk customers
- Discount for staying
- Free month extension
- Feature upgrade
- Survey Reason: Ask why customer canceling
- Partial Period Refunds: Not automatic
- Cancellation doesn't refund current period
- To refund partial period:
- Calculate days unused
- Create refund Transfer manually
- Or apply credit for future use
- Example: Cancel halfway through month
- Paid $49 for full month
- Used 15 days, 15 days unused
- Refund $24.50 manually if desired
- Common Workflows:
- Standard Cancellation:
- Customer clicks "Cancel Subscription"
- Show confirmation dialog
- Call DELETE /subscriptions/{id}
- Display "Subscription Canceled" message
- Send confirmation email
- Service continues until period end
- Cancel with Partial Refund:
- Cancel subscription (DELETE)
- Calculate unused days
- Create refund Transfer
- Email customer about refund
- Dunning Flow (Failed Payments):
- Payment fails 3 times
- Send final notice email
- Wait 7 days for customer to update payment
- If no update, cancel subscription
- Send cancellation notice
- Standard Cancellation:
- Reactivation: Customer wants to return
- Cannot uncancel
- Create new subscription
- May offer discount for returning customers
- Import previous settings/preferences
- State Changes:
- Before:
state: "ACTIVE" - After:
state: "CANCELED" - Can verify with GET /subscriptions/{id}
- Before:
- Webhooks: Listen for cancellation events
subscription.canceledwebhook- Trigger internal workflows
- Update CRM, analytics
- Send customer communications
- Historical Data: Canceled subscriptions remain accessible
- View via GET /subscriptions/{id}
- Filter via GET /subscriptions?state=CANCELED
- Important for reporting, analytics
- Calculate churn rate
- Related Endpoints:
- GET /subscriptions/{id}: Verify cancellation status
- POST /subscriptions: Create new subscription (if reactivating)
- POST /transfers: Create refund for partial period