listCustomerSubscriptions

❗️

Deprecated

This JSON-RPC method is deprecated.

Returns list of all your subscription offers purchased by the customer.

📘

This method will list only subscriptions which didn't expire (e.g returns the subscriptions for which the customer has still access rights to the content). Parameter 'status' in response may take value 'active' or 'cancelled'. Value 'active' means subscription will renew after expiration time, value 'cancelled' means user resigned and it will not be prolonged after it expires. Subscriptions which were cancelled and expired won't be listed by this method.

🚧

This method should not be used for real-time entitlement checks. Use getAccessStatus or getAccessibleTags instead.

Parameters

NameTypeDescription
publisherToken*stringYou can find your publisher token at api-keys page.
customerEmail*stringSet customer email which you want to get subscription list from
offset*integerInteger, from which element you want to get results.
limit*integerInteger, how many elements you want to get

Result parameters

NameTypeDescription
itemsobjectInformation about each subscription
-subscriptionIdintegerSubscription identifier at Cleeng
-offerIdstringSubscription offer ID, e.g. S123123123_US
-statusstringCurrent status of subscription, 'active' means subscription will renew after expiration time and 'cancelled' means user resigned and it will not be prolonged after it expires
-startedAtintegerStart of subscription period
-expiresAtintegerEnd of subscription period
-nextPaymentPricefloatPrice for upcoming subscription period
-nextPaymentCurrencystringPrice currency for upcoming subscription period
-nextPaymentAtintegerTime of next payment
-paymentGatewaystringExample values: adyen, ingenico, moneris, apple, paypal, roku, amazon, android
-paymentMethodstringExample values: mc, amex, visa, ios, tvos, paypal, roku, amazon, android
-externalPaymentIdstringExternal Id of the latest payment for this subscription
-inTrialbooleanIndicates if a subscription is in trial period or not
totalItemCountintegerTotal amount of your subscription offers currently owned by user
customerIdintegerCustomer identifier at Cleeng
pendingSwitchIdstringThe identifier of a pending switch. It will appear here if a subscription switch is in pending status (pending is the status of the switch between the subscription switch request and the actual switch processing). Otherwise, the value will be null.

API Request/Response

Request

{    
  "method": "listCustomerSubscriptions",    
  "params": {    
    "publisherToken": "TeurE3xRXcFtF7gSbhYCXx_qC1IrvnDWGejDv114-OE0cdZ9",     "customerEmail": "[email protected]",    
    "offset": "0",    
    "limit": "10"    
  },    
  "jsonrpc": "2.0",    
  "id": 1    
}

Response

{
  "result": {
    "items": [
      {
        "subscriptionId": 955044431,
        "offerId": "S123123123_US",
        "status": "active",
        "startedAt": 1653054759,
        "expiresAt": 1655966417,
        "nextPaymentPrice": 21.98,
        "nextPaymentCurrency": "USD",
        "nextPaymentAt": 1655750417,
        "paymentGateway": "apple",
        "paymentMethod": "tvos",
        "externalPaymentId": "",
        "inTrial": true,
        "pendingSwitchId": fd55c5be-919a-4b7b-9a7a-3bc09bca9f00
      },
      {
        "subscriptionId": 967464836,
        "offerId": "S321321321_US",
        "status": "active",
        "startedAt": 1653048697,
        "expiresAt": 1653653497,
        "nextPaymentPrice": 1.52,
        "nextPaymentCurrency": "USD",
        "nextPaymentAt": 1653437497,
        "paymentGateway": "android",
        "paymentMethod": "android",
        "externalPaymentId": "",
        "inTrial": false,
        "pendingSwitchId": null
      }
    ],
    "totalItemCount": 2
    "customerId": 801798658
  },
  "id": "1",
  "jsonrpc": "2.0"
}

PHP Example

<?php
    $customerEmail = '[email protected]';

    $cleengApi = new Cleeng_Api();
    $cleengApi->setPublisherToken('Y72a8Cr0KQciwzU7DbOcSXOFL1gT9a6gIYRb6hhOvCdPaxKW');

    $cleengApi->listCustomerSubscriptions($customerEmail, 0, 10);
?>