Deprecated
This JSON-RPC method is deprecated.
Updates subscription for a given customer.
This method can be used to make customer's subscription active, 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.
Parameters
Both parameters may be changed in single call if needed.
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 (active, cancelled or terminated) |
-expiresAt | integer | Extended expiration date. Time format is Unix timestamp |
-cancellationType | string | One of following: "paymentCancel", "userCancel", "publisherCancel" |
-cancellationReason | string | Any reason. In case of subscription is being terminated reason will be stored in subscribers report. |
Result 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 |
API Request/Response
Request
{
"method": "updateCustomerSubscription",
"params": {
"publisherToken": "IvVjsCSIOMkiwaDmWiWBflkVt8IRFl0jDNv9IDSAsYhYRfQ7",
"customerEmail": "[email protected]",
"offerId": "S9574O9588_US",
"subscriptionData": {
"status": "cancelled",
"expiresAt": "1517356800",
"cancellationType": "publisherCancel",
"cancellationReason": "Any reason"
}
},
"jsonrpc": "2.0",
"id": 1
}
Response
{
"result": {
"offerId": "S9574O9588_US",
"status": "cancelled",
"expiresAt": 1517356800,
"paymentMethod": "Card"
},
"id": "1",
"jsonrpc": "2.0"
}
ErrorCodes
Code | Description |
---|---|
3 | Invalid publisher token |
4 | Invalid offer ID |
8 | Invalid offer properties |
10 | Invalid email address |
16 | Invalid API argument |