Revoke Subscription
Revoke an active external subscription — sets status to "halted" and terminates access immediately. Provide either subscriptionId OR userId + mangoId to identify the subscription. Only external subscriptions (paymentProvider: "external") can be revoked through this API.
Authorization
bearer In: header
Header Parameters
Host name of the dashboard, ex: mydomain.tagmango.com
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api-prod-new.tagmango.com/api/v1/external/subscriptions/revoke" \ -H "x-whitelabel-host: string" \ -H "Content-Type: application/json" \ -d '{}'{
"_id": "66a1390268a76f2f5c9f39a3",
"fan": "66a1390268a76f2f5c9f39a3",
"creator": "66a1390268a76f2f5c9f39a3",
"mango": "66a1390268a76f2f5c9f39a3",
"subscribedAt": "2024-08-11T10:20:30Z",
"latestSubscriptionDate": "2024-08-11T10:20:30Z",
"expiredAt": "2024-08-11T10:20:30Z",
"paymentProvider": "Razorpay",
"status": "active",
"orders": [
"66a1390268a76f2f5c9f39a3",
"77b2390268a76f2f5c9f39a4"
],
"acquisitionType": "organic",
"isFree": true,
"amount": 1000,
"isLifetime": false,
"createdAt": "2024-11-04T13:05:43.799Z",
"updatedAt": "2024-11-04T13:05:43.799Z"
}{
"code": 400,
"type": "Bad Request",
"statusMessage": "BAD_REQUEST",
"errorCode": "SUBSCRIPTION_NOT_EXTERNAL",
"message": "The subscription was created through an internal payment provider. Only external subscriptions can be managed.",
"result": "The subscription was created through an internal payment provider. Only external subscriptions can be managed.",
"success": false
}{
"code": 401,
"type": "Unauthorized",
"statusMessage": "UNAUTHORIZED",
"message": "Invalid token",
"success": false
}{
"code": 403,
"type": "Forbidden",
"statusMessage": "FORBIDDEN",
"errorCode": "MANGO_CREATOR_MISMATCH",
"message": "The mango exists but is owned by a different creator than the queried creator",
"result": "The mango exists but is owned by a different creator than the queried creator",
"success": false
}{
"code": 404,
"type": "Not Found",
"statusMessage": "NOT_FOUND",
"errorCode": "SUBSCRIPTION_NOT_FOUND",
"message": "No subscription matching found for user and mango combination.",
"result": "No subscription matching found for user and mango combination.",
"success": false
}Grant Subscription Access POST
Activate or reactivate an existing subscription without payment. Provide either subscriptionId OR userId + mangoId to identify the subscription. Returns 404 if not found, 409 if already active.
Refund Subscription POST
Process a refund for an externally created order. Use action "initiate" to start a refund (halts subscription, sends notifications), then "complete" after processing on your payment gateway.