Get all your subscriptions.
URL: https://www.trade-copier.com/webservice/v4/subscription/getSubscriptions.php
The request can specify an optional filter with an array of numbers to only get certain types of subscriptions.
Response: JSON object list
| Field Name | Field Type | Field Description |
|---|---|---|
| subscription_key | string | Unique identifier of the subscription |
| name | string | Name of the susbcription |
| price | float | Price of the subscription |
| currency | string | Currency in which the subscription was paid for |
| cancel_date | string | Date and time of cancellation of subscription if applicable |
| expiration_date | string | Date and time of expiration of the subscription |
| status | int | Status of order |
| invoice_status | int | Last invoice's status |
| paid_date | string | Date and time of payment for the subscription |
| type | int | Type of subscription. 0: Free Master, 1: Free Slave, 2: Prepay, 3: Add-On, 4: Subscription 5: Prepay Daily |
| total_accounts | int | Total Number of accounts you can add with this subscription |
| available_accounts | int | Number of available accounts you can currently add with this subscription |
| app_name | string | Payment method |
| term | int | Billing cycle in days |
| invoices | array | All invoices of the deposit |
| invoice_key | string | Unique identifier of the invoice |
| total | string | Amount paid |
| currency | string | Currency in which the invoice was made |
| invoice_status | string | Status of the invoice order. 401=pending, 402=paid, 403=refunded |
| paid_date | string | Date on which the invoice was made |
| coupon_code | string | Coupon code of the invoice |
| amount | string | Discount from coupon, can be a percentage or absolute value |
| percentage | string | Indicates whether amount is a percentage or not. 1=percentage, empty means absolute value |
| app_name | string | Payment method |
PHP example
<?php
$url="https://www.trade-copier.com/webservice/subscription/v4/getSubscriptions.php";
$headers = array(
'Content-Type: application/x-www-form-urlencoded',
'Authorization: Bearer [[TOKEN]]',
);
// Open connection
$ch = curl_init();
// Setting the options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$filter = ['types' => [1, 3]];
//$filter = ['types' => [1]];
//$filter = [];
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($filter));
// Execute request
$json = json_decode(curl_exec($ch));
// Close connection
curl_close($ch);
//We access the subscription(s) list
if(array_key_exists('subscriptions', $json))
{
echo '<table id="api_data">';
foreach($json->subscriptions as $row) {
foreach($row as $key => $val) {
if($key != 'invoices')
echo '<th>'.$key.'</th>';
}
break;
}
foreach($json->subscriptions as $subscription)
{
echo '<tr>';
foreach($subscription as $key => $val)
{
if($key != 'invoices')
echo '<td>'.$val.'</td>';
}
echo '</tr>';
echo '<tr>';
foreach($subscription->invoices as $invoice)
{
echo '<th>Invoices</th>';
foreach($invoice as $key => $val)
{
echo '<th>'.$key.'</th>';
}
echo '<tr>';
echo '</tr>';
echo '<td></td>';
foreach($invoice as $key => $val)
{
echo '<td>'.$val.'</td>';
}
}
echo '</tr>';
echo '<tr><td></td></tr>';
}
echo '</table>';
}
else
{
//This is an error message that can be access like this:
//echo $json>code." ".$json>error;
echo json_encode($json);
}
?>