Skip to main content

Example subscription event notification flow

An example of a subscription event notification flow is shown below using a create subscription.

  1. User Bob purchases application Gizmo123. This creates a SUBSCRIPTION_ORDER event identified by URL https://www.acme-marketplace.com/api/integration/v1/events/12345.

  2. AppDirect calls http://example.com/create?url=https%3A%2F%2Fwww.acme-marketplace.com%2Fapi%2Fintegration%2Fv1%2Fevents%2F12345.

  3. Example.com issues an event notification to: https://www.acme-marketplace.com/api/integration/v1/events/12345\. If Example.com wants to receive the response from AppDirect in JSON format, they must add Accept: application/json in their HTTP GET request. If they want to receive the response from AppDirect in XML format they must add Accept: application/xml in their HTTP GET request. If they do not specify the content type an XML payload will be returned.

  4. AppDirect returns a subscription order event.

    • JSON
    {  
    "type": "SUBSCRIPTION_ORDER",
    "marketplace": {
    "baseUrl": "https://www.acme.com",
    "partner": "APPDIRECT"
    },
    "creator": {
    "address": {
    "firstName": "Sample",
    "fullName": "Sample Tester",
    "lastName": "Tester"
    },
    "email": "sampletester@testco.com",
    "firstName": "Sample",
    "language": "en",
    "lastName": "Tester",
    "locale": "en-US",
    "openId": "https://www.acme.com/openid/id/211aa367-f53b-4606-8887-80a381e0ef69",
    "uuid": "211aa369-f53b-4606-8887-80a361e0ef66"
    },
    "payload": {
    "company": {
    "country": "US",
    "name": "Sample Testing co.",
    "uuid": "bd58b532-323b-4627-a828-57729489b27b",
    "website": "www.testerco.com"
    },
    "order": {
    "editionCode": "FREE",
    "pricingDuration": "MONTHLY"
    }
    }
    }
    • XML
      <?xml version="1.0" encoding="UTF-8" ?>  
    <event>
    <type>SUBSCRIPTION_ORDER</type>
    <marketplace>
    <baseUrl>https://www.acme.com<baseUrl>
    <partner>APPDIRECT</partner>
    </marketplace>
    <creator>
    <address>
    <firstName>Sample</firstName>
    <fullName>Sample Tester</fullName>
    <lastName>Tester</lastName>
    </address>
    <email>sampletester@testco.com</email>
    <firstName>Sample</firstName>
    <language>en</language>
    <lastName>Tester</lastName>
    <locale>en-US</locale>
    <openId>https://www.acme.com/openid/id/211aa367-f53b-4606-8887-80a381e0ef69</openId>
    <uuid>211aa369-f53b-4606-8887-80a361e0ef66</uuid>
    </creator>
    <payload>
    <company>
    <country>US</country>
    <name>Sample Testing co.</name>
    <uuid>bd58b532-323b-4627-a828-57729489b27b</uuid>
    <website>www.testerco.com</website>
    </company>
    <order>
    <editionCode>FREE</editionCode>
    <pricingDuration>MONTHLY</pricingDuration>
    </order>
    </payload>
    </event>
  5. Example.com creates a new account for Bob in its account system.

  6. Example.com returns a JSON or XML response to the original HTTP request.

    • JSON
    Status Code: 200 OK  
    {
    "accountIdentifier":"789xyz",
    "success":true
    }
    • XML
    Status Code: 200 OK  
    <result>
    <accountIdentifier>789xyz</success>
    <success>true</success>
    </result>

In the event of an error, Example.com must return a valid error code, see Event error codes.

  • JSON
Status Code: 409 Conflict  
{
"success": "false"
"errorCode": "USER_ALREADY_EXISTS"
"message": "Optional message about the user already existing on ISV"
}
  • XML
Status Code: 409 Conflict  
<result>
<success>false</success>
<errorCode>USER_ALREADY_EXISTS</errorCode>
<message>Optional message about the user already existing on ISV</message>
</result>

Was this page helpful?