post http://{domain}/v1/api/purchase/subscription/prepare
This section of the document explains the redirection/web flow of subscriptions. To purchase a subscription, use this endpoint to initiate the purchase flow, this API can be accessed with Client Access Token obtained from the response of the Client Access Token API, if the endpoint is accessed with a client access token then at the end of the purchase flow the redirect URL includes a (query) parameter "?code=" which is an authorization code that can be used to obtain the User Access Token.
How to use:
- Fill in Authorization header: Bearer C1234abcde-1234-abcd-1234-abcd1234abcd (Replace with access_token that starts with letter C obtained from response of Client Access Token API request)
- Change the "redirect" and "subscriptionTypeID" in the body as per your specific configuration.
- (OPTIONAL) Add marketingCampaign details(conversionId, agency, medium...etc) to be relayed back in later notifications and stored in the subscriber's details.
- In the response received, click on the href link which should direct you to the Consent Gateway page that will authenticate your purchase request and
- Upon successful subscription there ill be a redirect, that redirect WILL include parameter "code=" with an Authorization Code and MIGHT include the parameter "uuid=" as this parameter is not available on all operators.
- Example Success Redirect URL:
http://www.myserviceURL.com/thankyou.html?code=Adb74b752-141c-4657-a705-98644a7808b4&message=OK&uuid=81427818-a692-4c41-86a5-af93827f2646&status=200 - Example Insufficient Funds URL:
http://www.myserviceURL.com/thankyou.html?code=Adb74b752-141c-4657-a705-98644a7808b4&error=INSUFFICIENT_FUNDS&uuid=81427818-a692-4c41-86a5-af93827f2646&status=402 - Example User Already Subscribed URL:
http://www.myserviceURL.com/thankyou.html?code=Adb74b752-141c-4657-a705-98644a7808b4&error=USER_ALREADY_SUBSCRIBED&message=User+already+subscribed+to+service.&uuid=81427818-a692-4c41-86a5-af93827f2646&status=409
- Example Success Redirect URL:
Purchase Link Validity period
The obtained href purchase link will be valid for single use only within 10 mins of its creation.
Authorization Code Validity period
The obtained Authorization Code will be valid for single use only!