Skip to main content

Cancelling UPI Autopay Enrollments

This guide quickly demonstrates how to cancel a pending or active enrollment in EBANX. We will walk you through the basic steps to achieve this goal using your already existing Direct API integration.

note

Users can cancel their enrollments using their App anytime. Each time a user changes the status of the enrollment EBANX will send an enrollment status update notification to the merchant.


Requirements

  • API credentials - Ensure you have your EBANX integration key. If not, complete the Merchant Signup Form.

Instructions

Follow the steps below.

  1. Ensure enrollment status is Pending or Accepted

    You can only cancel an enrollment if its status is equal to pending or accepted. You can check the status of your payment using the end-point ws/userenrollments/query referencing to its merchant_enrollment_code.

    Check the example:

    curl -X POST 'https://api.ebanx.com/ws/userenrollments/query' \
    --header 'Content-Type: application/json' \
    --data '{
    "integration_key": "{{integration_key}}",
    "payment_type_code": "upi-collect-autopay",
    "enrollment": {
    "country": "in",
    "merchant_enrollment_code": "{{unique_enrollment_code}}"
    }
    }'

    A successful request will return a JSON response like the one shown below. Enrollments with a status of accepted or pending are eligible for cancellation. Other possible enrollment statuses include not_accepted, expired, not_found, and revoked, none of which can be cancelled


    {
    "status": "SUCCESS",
    "enrollment": {
    "status": "accepted",
    "email": "{{customer_email}}"
    },
    "subscription": {
    "subscription_name": "Descriptor of the subscription.",
    "expiration_date": "2025-12-30",
    "frequency": "monthly",
    "fixed_amount": 19.90,
    "max_amount_floor": null,
    "retry": "allow_3R_7D"
    }
    }
  2. Cancel the enrollment

    To cancel an enrollment, you just need to call the end-point /ws/userenrollment (from your server) with the following required fields:

    ParameterRequirementDescription
    integration_keyRequiredYour unique and secret integration key
    operationRequiredMust be cancel
    payment_type_codeRequiredMust be upi-collect-autopay
    enrollment.countryRequiredMust be IN
    enrollment.merchant_enrollment_codeRequiredThe unique enrollment identifier

    Please, check the example below:

    curl -X POST 'https://sandbox.ebanx.com/ws/userenrollment' \
    --data '{
    "integration_key": "{{integration_key}}",
    "operation": "cancel",
    "payment_type_code": "upi-collect-autopay",
    "enrollment": {
    "merchant_enrollment_code": "{{unique_enrollment_code}}",
    "email": "email@example.com",
    "country": "IN"
    }'

    A successful request will return a JSON response similar to the one below, with a status revoked.

    {
    "status": "SUCCESS",
    "enrollment": {
    "status": "revoked"
    }
    }
  3. Congratulations!

    You have succesfully Cancelled a UPI Autopay Enrollment.

    For more information, refer to the
    Direct API reference guidechevron_right

Still need help?

Help Image

We hope this article was helpful. If you still have questions, you can explore the following options: