updateCustomerSubscription()


Updates subscription for a given customer.

This method can be used to cancel customer's subscription so it won't renew after expiration time or terminate subscription and remove customer's access instantly.

This method allows also to extend expiration time of current subscription.

Note: Both parameters may be changed in single call if needed.

Parameters:

Name Type Description
publisherToken string Your publisher token
customerEmail string Registration email of customer
offerId string ID of subscription to update, e.g. S123123123_US
subscriptionData object Dataset
-status string New subscription status (cancelled or terminated)
-expiresAt integer Extended expiration date. Time format is Unix timestamp

- required parameter

Response Parameters:

Name Type Description
offerId string Subscription offer ID
status string Current status of subscription
expiresAt integer End of subscription period
paymentMethod string Payment method used to purchase subscription

Error Codes:

Code Description
3 Invalid publisher token
4 Invalid offer ID
8 Invalid offer properties
10 Invalid email address
16 Invalid API argument

Request:

[
    {
        "method": "updateCustomerSubscription",
        "params": {
            "publisherToken": "IvVjsCSIOMkiwaDmWiWBflkVt8IRFl0jDNv9IDSAsYhYRfQ7",
            "customerEmail": "customer@email.com",
            "offerId": "S9574O9588_US",
            "subscriptionData": {
                "status": "cancelled",
                "expiresAt": "1517356800"
            }
        },
        "jsonrpc": "2.0",
        "id": 1
    }
]

Response:

[
    {
        "result": {
            "offerId": "S9574O9588_US",
            "status": "cancelled",
            "expiresAt": 1517356800,
            "paymentMethod": "Card"
        },
        "id": "1",
        "jsonrpc": "2.0"
    }
]

Remember! you can always check it by yourself using API Console - updateCustomerSubscription()

Back to Customer API