cancelSubscription

If successful the subscription becomes canceled and will not be renewed at the end of the current subscription period. The subscription will remain valid until the end of the current subscription period. The subscription to cancel is identified by a purchase ID that is returned at the time of purchase or queried by calling getExistingPurchases. The cancelation of a non-subscription digital good is not permitted.

Synopsis:

void blackberry.payment.cancelSubscription(purchaseID, onSuccess, onFailure)

Parameters:

purchaseID {String}

purchaseID The purchase ID when the subscription was purchased.

onSuccess {Function}

Function to be balled on success.

data.cancelSubscription {Boolean}

True if the cancellation was successful.

onFailure {Function}

Function to be invoked when an error occurs.

error {PaymentError}

A PaymentError object containing details about the error.

Example:

<script type="text/javascript">

    function cancelSubscription() {
        try {
            blackberry.payment.cancelSubscription("12345", onSuccess, onFailure);
        } catch (e) {
            alert ("Error" + e);
        }
    }

    function onSuccess(data) {
        alert("Cancellation " + (data.subscriptionCancelled ? "" : "NOT ") + "successful");
    }

    function onFailure(error) {
        alert("Error occurred: " + error.errorText + ", " + error.errorID);
    }

</script>
            

Last modified: 2014-03-10



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus