Cancel Subscription
Cancel an active subscription transaction upon customer request, deactivating it to prevent any further charges.
Cancel Subscription Transaction
API Endpoint
Use the following API endpoint to cancel a subscription:
Sandbox Cancel API
Below cancel API strictly for sandbox testing only. Never use these sandbox URL's in production environment
Production Cancel API
Use the following cancel API strictly for production transactions. Ensure that you never use these production URLs in the sandbox or testing environment
Authentication
- No additional authentication headers are required for the Subscription Cancel API.
- Ensure customer consent has been obtained before initiating cancellation.
Request Details
Pass the subscription token as a path parameter in the DELETE request:
$baseUrl = 'http://sandbox.hesabe.com/api/'; // sandbox
$token = '84221717315765789865847566756';
$cancelApiUrl = "{$baseUrl}/subscription/cancel/{$token}";
$cancelRequest = Request::create($cancelApiUrl, 'DELETE'); Request Parameters
| Field | Type | Description | Required |
|---|---|---|---|
token | Alphanumeric | The token of the active subscription transaction to be cancelled | Yes |
Response Details
The response is returned in plain JSON and does not require decryption.
Example Response
{
"status": true,
"code": 200,
"message": "Subscription cancelled."
}Response Parameters
| Field | Type | Description |
|---|---|---|
status | Boolean | Indicates whether the cancellation was successful |
code | Numeric | HTTP status code of the response |
message | String | Descriptive message about the cancellation result |
Error Handling
Common errors you may encounter:
| Error | Description |
|---|---|
| Invalid Token | Token provided is incorrect or expired |
| Subscription Not Found | No active subscription found for the given token |
| Invalid Request | Request is malformed or missing required parameters |
Example Error Response
{
"status": false,
"code": 400,
"message": "Invalid token or subscription not found."
}For Any Technical Assistance
If you encounter any issues or need support during setup or integration, please contact our technical team for assistance.
Hesabe IT Support
Capture Subscription
Capture payments for an active subscription transaction after the initial authorization, enabling flexible billing at any frequency or amount.
Webhook Integration
Implement a webhook to receive real-time transaction updates by creating a POST API endpoint designed to accept transaction parameters. Include your URL in the "webhookUrl" variable along with other required parameters as specified in the Hesabe developer portal.