Update subscription interface allows to update merchants to update below parameters of the subscription -
- authRefId
- subscriberEmail
- subscriberMobile
- customParameters
These details can be passed together or separately in update subscription call as per merchant’s convenience. Please note that they will overwrite existing values present in the current subscription
Post Method: PATCH
Path: {base_url}/api/sub/v1/merchant/subscriptions/{subscriptionId}
Header
Parameter | Value |
---|---|
X-PayU-Subscription-Signature | SHA512 Signature generated by encrypting request parameters in the body by Merchant Key, Merchant Salt and Plan ID. |
merchantId | Merchant Key received during onboarding. For example, smsplus. |
X-PayU-Subscription-Signature Generation Method
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. The following logic must be used:
Signature = SHA512("merchantId:" + merchantId + "|subscriptionId:" + subscriptionId + "|" + merchantSalt)
Sample request body
{
"authRefId": "10",
"subscriberEmail": "[email protected]",
"subscriberMobile": "9999999999",
"customParameter": {
"Policynumber": "8885533311111",
"Policytype": "Franklin Life"
}
}
Sample response
{
"subscriptionId": "5c9517f2652d405ed9834f3f",
"createdDate": "2019-03-24T06:56:53.871Z",
"modifiedDate": "2019-03-24T13:33:26.140Z",
"subscriptionPlans": [
{
"planId": "ZION155341061387133",
"startDate": "2019-03-26T11:00:00.000Z",
"totalCount": 5,
"numberOfPaidInvoices": 0,
"numberOfInvoiceGenerated": 0,
"status": "Active",
"deleted": false,
"nextBillingDates": "2019-03-26T11:00:00Z",
"lastPaymentDates": null,
"billingInterval": 1,
"billingCycle": "DAILY",
"planName": "Premium",
"amount": {
"value": 2,
"currency": "INR"
}
}
],
"authRefId": "10",
"status": "Enabled",
"subscriberEmail": "[email protected]",
"subscriberMobile": "9999999999",
"customParameter": {
"Policynumber": "8885533311111",
"Policytype": "Franklin Life"
},
"possibleActions": [
{
"action": "Fetch Subscription",
"href": "{{base-url}}/api/sub/v1/subscription/5c972a35652d405ed9834f52",
"httpMethod": "GET"
},
{
"action": "Delete Subscription",
"href": "{{base-url}}/api/sub/v1/subscription/5c972a35652d405ed9834f52",
"httpMethod": "DELETE"
}
]
}
HTTP status codes
The response body returned as a part of Update Subscription is same as that of Defined Subscription interface along with the following status codes getting returned.
HTTP Status Code | Description |
---|---|
200 | Subscription updated successfully |
403 | Forbidden request invalid Signature |
400 | Request is malformed |
404 | Merchant or Plan Id not found |
422 | Request has invalid values |
500 | Interval Server Error |