Buy subscription

  • Since SDK: 19

Purchase a subscription with the given product ID.

adobe.dps.store.buySubscription

Parameter Type Description
subscriptionProductId

string

A string containing the product id of the subscription to buy.
callback

buySubscriptionFunction

Function that will be called with this signature: {"result":status} where status is one of "succeeded", "failed", "cancelled", "refunded", "notsupported"
withAnalytics

boolean

An optional boolean indicating whether you want the Viewer app to track analytics for this event. If you track analytics via JavaScript in your own store, pass in false. Default value: true

buySubscriptionFunction

Parameter Type Description
dictionary

buySubscriptionResult

A dictionary containing the result status.
"result"

buySubscriptionStatus

The subscription buying status.

API Snippet

buySubscription

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Buy Subscription API</title>
<script type="text/javascript">
function buySubscription()
{
  var folioID = document.getElementById("buy").value;
  // call into the buySubscription API
  adobe.dps.store.buySubscription(subscriptionID, function(returnedData)
    {
      var status = returnedData['result'];
      document.write("<p>Buy Subscription returned with a " + status + " result</p>");
    }
  );
}
</script>
</head>

<body>
<p>Buy MySubscription</p> 
<button type="button" id="buy" value="12345" onclick="buySubscription()">Buy Now</button>
</body>
</html>