Retrieve subscriptions
Overview
Extract information on your account’s subscriptions. Use the searchSubscriptions method to retrieve details about your account’s subscriptions, based on a set of filters.
Parameters
Parameters | Type/Description |
---|---|
sessionID |
Required (string) |
|
Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect. The sessionID expires in 10 minutes. |
searchBy |
Optional (Object) |
Unique, system-generated subscription identifier. |
SubscriptionSearchOptions Parameters | Type/Description |
---|---|
CustomerEmail |
Optional (string) |
|
Customer email address. Can be NULL. |
ExactMatchEmail | Optional (Boolean) |
Force search by email to perform exact match; recommended to keep this option set to true in order to avoid matching similar email addresses from multiple customers. |
|
DeliveredCode |
Optional (string) |
Activation key/code. Can be NULL. |
|
AvangateCustomerReference |
Optional (int) |
|
System-generated customer reference. Can be NULL. |
ExternalCustomerReference |
Optional (string) |
|
External customer reference that you control. Can be NULL. |
Aggregate |
Optional (boolean) |
|
true - search will work across all your aggregated 2Checkout accounts. false - default value. You limit the search to the account whose details you used for authentication. Can be NULL. |
SubscriptionEnabled |
Optional (boolean) |
|
true for enabled subscriptions. false for disabled subscriptions. Can be NULL. |
RecurringEnabled |
Optional (StringArray) |
|
true – 2Checkout charges customers using recurring billing for subscriptions. false – customers need to make manual payments to renew their subscriptions. Can be NULL. |
ProductCodes |
Optional (StringArray) |
|
Product identifier that you control. Can be NULL. |
CountryCodes |
Optional (string) |
|
Country code (ISO 3166 two-letter code). Can be NULL. |
PartnerCode | Optional (string) |
Can be NULL. | |
PurchasedAfter |
Optional (string) |
|
YYYY-MM-DD. Subscription search interval start. You can search for subscriptions purchased between the dates you set using PurchasedAfter and PurchasedBefore. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL. |
PurchasedBefore |
Optional (string) |
|
YYYY-MM-DD. Subscription search interval end. You can search for subscriptions purchased between the dates you set using PurchasedAfter and PurchasedBefore. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL. |
ExpireAfter |
Optional (string) |
|
YYYY-MM-DD. Search subscriptions set to expire after a specific date. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL. |
ExpireBefore |
Optional (string) |
|
YYYY-MM-DD. Search subscriptions set to expire before a specific date. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL. |
ModifiedAfter | Optional (string) |
YYYY-MM-DD HH-MM-SS. Search subscriptions modified after a specific date. | |
ModifiedBefore | Optional (string) |
YYYY-MM-DD HH-MM-SS. Search subscriptions modified before a specific date. | |
RenewedAfter |
Optional (string) |
|
YYYY-MM-DD. Search subscriptions renewed after a specific date. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL. |
RenewedBefore |
Optional (string) |
|
YYYY-MM-DD. Search subscriptions renewed before a specific date. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL. |
NotificationAfter |
Optional (string) |
|
YYYY-MM-DD. Search subscriptions for which the 2Checkout system sent out notifications after a specific date. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL. |
NotificationBefore |
Optional (string) |
|
YYYY-MM-DD. Search subscriptions for which the 2Checkout system sent out notifications before a specific date Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL. |
Type |
Optional (string) |
|
trial - trial subscriptions. regular - all generated subscriptions that are not trials. regularfromtrial - subscriptions generated from a trial conversion. Can be NULL. |
TestSubscription |
Optional (boolean) |
|
true false, depending on whether you want to include test subscriptions in the search or not. Can be NULL. |
LifetimeSubscription |
Optional (boolean) |
|
true – evergreen subscriptions. false - subscriptions with a limited recurring billing cycle, typically no larger than 36 months. Can be NULL. |
Page |
Optional (int) |
|
A specific page of search results. Default value is 1. Can be NULL. |
Limit |
Optional (int) |
|
Number of results (subscriptions) displayed per page. Default value is 10. Can be NULL. |
Response
Parameters | Type/Description |
---|---|
Array of objects |
Request
<?php
require ('PATH_TO_AUTH');
$SubscriptionSearch = new stdClass();
$SubscriptionSearch->CustomerEmail = 'example@email.com';
$SubscriptionSearch->DeliveredCode = null;
$SubscriptionSearch->AvangateCustomerReference = null;
$SubscriptionSearch->ExternalCustomerReference = null;
$SubscriptionSearch->Aggregate = false;
$SubscriptionSearch->SubscriptionEnabled = null; //true false null
$SubscriptionSearch->RecurringEnabled = null; // true - autorenewal, false - manual renewal, null = both(default)
$SubscriptionSearch->ProductCodes = null; //array('Product_Code1', 'Product_Code2');
$SubscriptionSearch->CountryCodes = null;//array ('au')
$SubscriptionSearch->PartnerCode = null;
$SubscriptionSearch->PurchasedAfter = null;
$SubscriptionSearch->PurchasedBefore = null;
$SubscriptionSearch->ExpireAfter = null;
$SubscriptionSearch->ExpireBefore = null;
$SubscriptionSearch->LifetimeSubscription = null;
$SubscriptionSearch->Type = 'regular'; //'trial', 'regular', 'regularfromtrial'
$SubscriptionSearch->TestSubscription = null; // true, false, null = both(default) $SubscriptionSearch->Page = 1;$SubscriptionSearch->Limit = 25;
$SubscriptionSearch->Page = 1;
$SubscriptionSearch->Limit = 10;
$jsonRpcRequest = array (
'method' => 'searchSubscriptions',
'params' => array($sessionID, $SubscriptionSearch),
'id' => $i++,
'jsonrpc' => '2.0');
var_dump (callRPC((Object)$jsonRpcRequest, $host, true));