Cancel subscription
Existing subscriptions can be canceled either through the AppDirect user interface, or by calling the AppDirect subscription API.
The cancel subscription event notification allows vendors to receive notice (SUBSCRIPTION_CANCEL) when the customer cancels an existing subscription. In order to allow users to cancel their subscription to your product, Developers define a subscription cancel notification URL, such as https://example.com/cancel?eventUrl= eventUrl, on the product's Edit integration page.
If AppDirect does not receive a successful response from the vendor to a SUBSCRIPTION_CANCEL event, the cancellation process is aborted, and the subscription stays in its current state. The customer is notified of the failure and presented with the error message returned by the vendor.
The general flow for a cancel subscription event notification is as follows:
- A user cancels a subscription from AppDirect.
- AppDirect creates a SUBSCRIPTION_CANCEL event identified by a corresponding token value.
- AppDirect calls the Subscription Cancel Notification URL.
- The vendor validates AppDirect's OAuth-signature.
- The vendor issues a request to read the SUBSCRIPTION_CANCEL event information using the token value. See Authorize inbound API requests for information on how to securely retrieve event details. This subscription cancel event contains:
- type: The type of the event (SUBSCRIPTION_CANCEL in this case)
- marketplace: Information about the AppDirect-powered marketplace on which the event took place.
- creator: The identity of the admin creating the event.
- payload: The event payload, containing the following elements:
- account: The account identifier provided by the vendor in the initial Subscription Order Event.
- The vendor returns a result JSON or XML with these parameters:
- success: Which should be "true" or "false."
- errorCode: If "success" is false, this must return a valid error code, see Event error codes.
- message: An optional message containing information about the result of the operation.
Example SUBSCRIPTION_CANCEL event notification
- JSON
{
"type": "SUBSCRIPTION_CANCEL",
"marketplace": {
"baseUrl": "https://www.acme.com",
"partner": "APPDIRECT"
},
"creator": {
"address": {
"city": "Sommerville",
"country": "US",
"firstName": "Test",
"fullName": "Test User",
"lastName": "User",
"phone": "5305556465",
"state": "MA",
"street1": "55 Grove St",
"zip": "02144"
},
"email": "testuser@testco.com",
"firstName": "Test",
"language": "en",
"lastName": "User",
"locale": "en-US",
"openId": "https://www.acme.com/openid/id/d124bf8b-0b0b-40d3-831b-b7f5a514d487",
"uuid": "d124bf8b-0b0b-40d3-831b-b7f5a514d487"
},
"payload": {
"account": {
"accountIdentifier": "9d6fca98-aa94-462b-85fa-118804ad3fe3",
"status": "ACTIVE"
}
}
}
- XML
<?xml version="1.0" encoding="UTF-8" ?>
<event>
<type>SUBSCRIPTION_CANCEL</type>
<marketplace>
<baseUrl>https://www.acme.com</baseUrl>
<partner>APPDIRECT</partner>>
</marketplace>
<creator>
<address>
<city>Sommerville</city>
<country>US</country>
<firstName>Test</firstName>
<fullName>Test User</fullName>
<lastName>User</lastName>
<phone>5305556465</phone>
<state>MA</state>
<street1>55 Grove St</street1>
<zip>02144</zip>
</address>
<email>testuser@testco.com</email>
<firstName>Test</firstName>
<language>en</language>
<lastName>User</lastName>
<locale>en-US</locale>
<openId>https://www.acme.com/openid/id/d124bf8b-0b0b-40d3-831b-b7f5a514d487</openId>
<uuid>d124bf8b-0b0b-40d3-831b-b7f5a514d487</uuid>
</creator>
<payload>
<account>
<accountIdentifier>9d6fca98-aa94-462b-85fa-118804ad3fe3</accountIdentifier>
<status>ACTIVE</status>
</account>
</payload>
</event>
Was this page helpful?
Tell us more…
Help us improve our content. Responses are anonymous.
Thanks
We appreciate your feedback!