updateCustomerSubscription

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.

📘

You can try that method by clicking here

NameTypeDescription
publisherToken*stringYour publisher token
customerEmail*stringRegistration email of customer
offerId*stringID of subscription to update, e.g. S123123123_US
subscriptionDataobjectDataset
-statusstringNew subscription status (active, cancelled or terminated)
-expiresAtintegerExtended expiration date. Time format is Unix timestamp
-cancellationTypestringOne of following: "paymentCancel", "userCancel", "publisherCancel"
-cancellationReasonstringAny reason. In case of subscription is being terminated reason will be stored in subscribers report.

Result Parameters

NameTypeDescription
offerIdstringSubscription offer ID
statusstringCurrent status of subscription
expiresAtintegerEnd of subscription period
paymentMethodstringPayment 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

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