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

http://sandbox.hesabe.com/api/subscription/cancel/{token}

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

https://api.hesabe.com/api/subscription/cancel/{token}

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:

subscription-cancel.php
    $baseUrl = 'http://sandbox.hesabe.com/api/'; // sandbox
    $token = '84221717315765789865847566756'; 
    $cancelApiUrl = "{$baseUrl}/subscription/cancel/{$token}"; 
    $cancelRequest = Request::create($cancelApiUrl, 'DELETE'); 

Request Parameters

FieldTypeDescriptionRequired
token
AlphanumericThe token of the active subscription transaction to be cancelledYes

Response Details

The response is returned in plain JSON and does not require decryption.

Example Response

success-response.json
{
  "status": true,
  "code": 200,
  "message": "Subscription cancelled."
}

Response Parameters

FieldTypeDescription
status
BooleanIndicates whether the cancellation was successful
code
NumericHTTP status code of the response
message
StringDescriptive message about the cancellation result

Error Handling

Common errors you may encounter:

ErrorDescription
Invalid TokenToken provided is incorrect or expired
Subscription Not FoundNo active subscription found for the given token
Invalid RequestRequest is malformed or missing required parameters

Example Error Response

error-response.json
{
  "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

Email address:itsupport@hesabe.com