Delete Existing Plan from Subscription API

Like association of one or more plans, merchant can also delete existing plan from given customer. In this case subscription will stop charging customer for deleted plan and rest of the plans will continue to work.

HTTP method: DELETE

Path: {base_url}/api/sub/v1/merchant/subscriptions/{subscriptionId}/plans/{planId}

Request parameters

Header

ParameterDescription
X-PayU-_

_Subscription- Signature
mandatory
SHA512 Signature generated by encrypting request parameters in body by Merchant Key, Merchant Salt and Subscription Id.
merchantId
mandatory
Merchant Key received during onboarding.
Example: YQeVda

Generating X-PayU-Subscription-Signature

X-PayU-Subscription-Signature is SHA 512 signature used to provide security layer over existing APIs. Every API will have its own logic to generate X-PayU-Subscription- Signature logic. Let’s look at how it is calculated for Update Subscription API.

Signature = SHA512(“merchantId:" + merchantId + "|subscriptionId:" + subscriptionId + "|planId:" + planId + "|" + merchantSalt)

Example

SHA512(merchantId:YQeVda|subscriptionId:5c9517f2652d405ed9834f3f|planId:ZION1 55343600151833|1v9b1)

Where “YQeVda” is merchant key and “1v9b1” is merchant salt.

Sample request

https://subscription.citruspay.com/api/sub/v1/merchant/subscriptions/5c972a35652d405ed9834f52/plans/ZION155343600151833

HTTP response codes

If subscription is cancelled successfully, then the HTTP method code 204 is returned to merchant as a part of API call.

📘

Reference:

It is worth to note that post calling above interface, the deleted plan from subscriptionPlans object will have status as Inactive and deleted parameter value as true. This can be validated using the Get Subscription Details API. For more information, refer to Get Subscription Details API

HTTP Status CodeDescription
204Plan is deleted successfully
403Forbidden request invalid Signature
400Request is malformed
404Merchant or Plan Id not found
422Request has invalid values
500Interval Server Error