Cancel Suscription

The POST /subscription.cancel/{subscriptionId} endpoint allows merchants to cancel an existing One Click Payment (OCP) subscription, revoking the customer's prior authorization for future charges.

This functionality ensures that merchants can manage the lifecycle of a subscription, allowing them to deactivate subscriptions when no longer needed or upon customer request. Once canceled, the subscription token becomes invalid and can no longer be used for initiating payments.

Endpoints

📘

URL

Certification: https://cert.subscriptions.payin.monnet.io/api/v1/subscription/cancel

Production: https://subscriptions.payin.monnet.io/api/v1/subscription/cancel

📝 Subscription Cancellation Request

🔐 Header Required

All requests to the /subscription.cancel endpoint must include a custom Authorization header to ensure secure communication and proper merchant validation.

HeaderValue FormatRequired
AuthorizationBearer SHA512(merchantId + type + customerId + processorCode + keyPayin)✅ Yes

The Authorization value must be a SHA-512 hash generated by concatenating the following fields:

FieldDescription
merchantIdInteger (Required)
Unique identifier assigned to the merchant by Monnet.
typeString (Required)
Type of operation. Possible values: ON_DEMAND (one-time payment) or RECURRENT (recurring payment).
customerIdString (Required)
Unique identifier of the end user or customer within the merchant’s system.
processorCodeString (Required)
Code identifying the payment processor to be used for the transaction.
keyPayinString (Required)
Secret key provided by Monnet for secure authentication of payment operations.

📥 Request Data

Specifies the structure and required parameters for the request body to ensure the successful cancellation of a subscription.

FieldDescription
merchantIdInteger (Required)
Unique ID assigned to the merchant by Monnet
subscriptionDetailsObject (Required)
typeString (Required)
Subscription type. Allowed value: **ON_DEMAND or RECURRENT**
customerIdString (Required)
Unique identifier of the customer within the merchant’s system
Example:
992984321
processorCodeString (Required)
Code identifying the selected payment processor
Example:
`Yape_on_file

This service allows merchants to cancel an existing One Click Payment (OCP) subscription associated with a customer. Once canceled, the subscription token will no longer be valid for initiating future payments.

Request Body (JSON)

The merchant must send a JSON payload with the following structure:

{
  "merchantId": 1073741824,
  "subscriptionDetails": {
    "type": "ON_DEMAND",
    "customerId": "140912518",
    "processorCode": "Yape_on_file"
  }
}

🔄 Subscription Cancellation Response

📤 Success Response Data

FieldDescription
subscriptionIdInteger (Required)
Unique identifier of the subscription that has been successfully cancelled
statusString (Required)
Status returned by processor.
Example
´ CANCELLED

If the subscription cancellation request is valid, the service will respond with a 200 OK status and return a JSON payload confirming the operation, including the subscription ID and a status indicating that the subscription has been successfully cancelled.

✅ Successful Response – 200 OK

{
  "subscriptionId": 1073741824,
  "status": "CANCELLED"
}

📤 Error Response Data

FieldDescription
errorCodeString (Opcional)
General code representing the main error type. Typically business-level.
See Errors Code
errorMessageString (Required)
Human-readable description of the general error
See Errors Code
errorFieldDetailsArray (Opcional)
List of specific errors encountered during processing
fleldString (Required)
Refers to the affected field.
errorMessageString (Required)
Description of the specific error

This response indicates that the subscription transaction could not be processed due to a business or validation error. It provides both a general error message and a detailed list of one or more specific underlying errors.

❌Error Response Body (JSON)

{
    "errorCode": "9025",
    "errorMessage": "Unable to locate record on file"
    
}

Errors Code

Error CodeError Message
E401Unauthorized request
B401The merchant does not exists
B404The merchant does not contain the correct processor settings
B405Subscription not active
B409Conflict request
9025Unable to locate record on file
9099error