Phriction DatingVIP Public Payment Application Project API Documentation subscription.change History Version 1 vs 2
Version 1 vs 2
Version 1 vs 2
Content Changes
Content Changes
== subscription.change ==
==== Description ====
Edit existing subscription by altering it's parameters.
==== Input Parameters ====
<table>
<tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
<tr><td>item_id</td><td>Int</td><td>Yes</td><td>PV2 item_id</td></tr>
<tr><td>pp_type</td><td>string</td><td>Yes</td><td>PP Type (NB|RG|PO|...)</td></tr>
<tr><td>next_rebill_date</td><td>date</td><td>Yes</td><td>Next Rebill date in YYYY-MM-DD format</td></tr>
<tr><td>rebill_unit</td><td>string</td><td>Yes</td><td>Rebill Unit (day|week|month|year)</td></tr>
<tr><td>rebill_period</td><td>int</td><td>Yes</td><td>Rebill period that will affect num of rebill unit used for rebills (i.e. 3 months)</td></tr>
<tr><td>next_rebill_amount</td><td>float</td><td>Yes</td><td>Amount to be used for next rebill only</td></tr>
<tr><td>rebill_amount</td><td>float</td><td>Yes</td><td>Amount to be used for all rebills (except for next)</td></tr>
</table>
==== Returned ====
<table>
<tr><th>Name</th><th>Type</th><th>Description</th></tr>
<tr><td>result</td><td>boolean</td><td>True on success false on failure</td></tr>
</table>
==== Usage Example ====
```
<?php
require_once "curl_http_client/curl_http_client.php";
$curl = new Curl_HTTP_Client();
//setup payment url and timeout
$payment_url = 'https://dev-payment.datingvip.com';
$timeout = 30;
//generate post data
$post_data = array
(
'token' => 'some-token',
'password' => '130d04b8123456857e47b254ebfbb53f',
'command' => 'subscription.change',
'data' => array(
'item_id' => 1,
'pp_type' => 'RG',
'next_rebill_date' => '2013-10-30',
'rebill_unit' => 'month',
'rebill_period' => 1,
'next_rebill_amount' => 9.99,
'rebill_amount' => 29.99
),
);
$response = $curl->send_post_data($payment_url, $post_data, null, $timeout);
if($response === false)
{
//handle errors
}
//decode json to get array
$response = json_decode($response, true);
var_dump($response);
?>
```
Excepted output after running this script should be:
```
array (size=9)
'code' => int 700
'status' => string 'Action completed succesfully' (length=28)
'command' => string 'subscription.change' (length=19)
'result' => boolean true
'request' =>
array (size=4)
'token' => string 'some-token' (length=10)
'password' => string '130d04b8123456857e47b254ebfbb53f' (length=32)
'command' => string 'subscription.change' (length=19)
'data' =>
array (size=7)
'item_id' => int 1
'pp_type' => string 'RG' (length=2)
'next_rebill_date' => string '2013-10-30' (length=10)
'rebill_unit' => string 'month' (length=5)
'rebill_period' => int 1
'next_rebill_amount' => float 9.99
'rebill_amount' => float 29.99
'ts' => int 1382553121
'origin_ip' => boolean false
'debug' => null
'errors' => null
```
== subscription.change ==
==== Description ====
Edit existing subscription by altering it's parameters.
==== Input Parameters ====
<table>
<tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
<tr><td>item_id</td><td>Int</td><td>Yes</td><td>PV2 item_id</td></tr>
<tr><td>pp_type</td><td>string</td><td>Yes</td><td>PP Type (NB|RG|PO|...)</td></tr>
<tr><td>next_rebill_date</td><td>date</td><td>Yes</td><td>Next Rebill date in YYYY-MM-DD format</td></tr>
<tr><td>rebill_unit</td><td>string</td><td>Yes</td><td>Rebill Unit (day|week|month|year)</td></tr>
<tr><td>rebill_period</td><td>int</td><td>Yes</td><td>Rebill period that will affect num of rebill unit used for rebills (i.e. 3 months)</td></tr>
<tr><td>next_rebill_amount</td><td>float</td><td>Yes</td><td>Amount to be used for next rebill only</td></tr>
<tr><td>rebill_amount</td><td>float</td><td>Yes</td><td>Amount to be used for all rebills (except for next)</td></tr>
</table>
==== Returned ====
<table>
<tr><th>Name</th><th>Type</th><th>Description</th></tr>
<tr><td>result</td><td>boolean</td><td>True on success false on failure</td></tr>
</table>
==== Usage Example ====
```
<?php
$curl = new \Dinke\CurlHttpClient;
//setup payment url and timeout
$payment_url = 'https://dev-payment.datingvip.com/api.json';
$timeout = 30;
$curl->setCredentials('some-token', 'some-pass');
$post_data = array(
'cmd' => 'subscription.change',
'data' => array(
'item_id' => 20004,
'pp_type' => 'RG',
'next_rebill_date' => '2015-04-30',
'rebill_unit' => 'month',
'rebill_period' => 1,
'next_rebill_amount' => 9.99,
'rebill_amount' => 29.99
),
);
$response = $curl->sendPostData($payment_url, $post_data, null, $timeout);
if($response === false)
{
//handle errors
}
//decode json to get array
$response = json_decode($response, true);
var_dump($response);
?>
```
Excepted output after running this script should be:
```
array (size=1)
'result' =>
array (size=8)
'code' => int 700
'status' => string 'Action completed succesfully' (length=28)
'command' => string 'subscription.change' (length=19)
'result' => boolean true
'request' =>
array (size=4)
'cmd' => string 'subscription.change' (length=19)
'data' =>
array (size=7)
'item_id' => string '20004' (length=5)
'pp_type' => string 'RG' (length=2)
'next_rebill_date' => string '2015-04-30' (length=10)
'rebill_unit' => string 'month' (length=5)
'rebill_period' => string '1' (length=1)
'next_rebill_amount' => string '9.99' (length=4)
'rebill_amount' => string '29.99' (length=5)
'token' => string 'some-token' (length=26)
'pass' => string 'some-pass' (length=32)
'ts' => int 1429562351
'origin_ip' => string '93.87.220.184' (length=13)
'errors' => null
```
== subscription.change ==
==== Description ====
Edit existing subscription by altering it's parameters.
==== Input Parameters ====
<table>
<tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
<tr><td>item_id</td><td>Int</td><td>Yes</td><td>PV2 item_id</td></tr>
<tr><td>pp_type</td><td>string</td><td>Yes</td><td>PP Type (NB|RG|PO|...)</td></tr>
<tr><td>next_rebill_date</td><td>date</td><td>Yes</td><td>Next Rebill date in YYYY-MM-DD format</td></tr>
<tr><td>rebill_unit</td><td>string</td><td>Yes</td><td>Rebill Unit (day|week|month|year)</td></tr>
<tr><td>rebill_period</td><td>int</td><td>Yes</td><td>Rebill period that will affect num of rebill unit used for rebills (i.e. 3 months)</td></tr>
<tr><td>next_rebill_amount</td><td>float</td><td>Yes</td><td>Amount to be used for next rebill only</td></tr>
<tr><td>rebill_amount</td><td>float</td><td>Yes</td><td>Amount to be used for all rebills (except for next)</td></tr>
</table>
==== Returned ====
<table>
<tr><th>Name</th><th>Type</th><th>Description</th></tr>
<tr><td>result</td><td>boolean</td><td>True on success false on failure</td></tr>
</table>
==== Usage Example ====
```
<?php
require_once "$curl_http_client/curl_http_client.php";
$curl = new = new \Dinke\Curl_HTTP_HttpClient();;
//setup payment url and timeout
$payment_url = 'https://dev-payment.datingvip.com/api.json';
$timeout = 30;
//generate post data
$post_data = array
(
'token' => $curl->setCredentials('some-token',
'password' => '130d04b8123456857e47b254ebfbb53f', 'some-pass');
$post_data = array(
'comman'cmd' => 'subscription.change',
'data' => array(
'item_id' => 120004,
'pp_type' => 'RG',
'next_rebill_date' => '2013-105-04-30',
'rebill_unit' => 'month',
'rebill_period' => 1,
'next_rebill_amount' => 9.99,
'rebill_amount' => 29.99
),
);
$response = $curl->send_post_dPostData($payment_url, $post_data, null, $timeout);
if($response === false)
{
//handle errors
}
//decode json to get array
$response = json_decode($response, true);
var_dump($response);
?>
```
Excepted output after running this script should be:
```
array (size=91)
'result' =>
array (size=8)
'code' => int 700
'status' => string 'Action completed succesfully' (length=28)
'command' => string 'subscription.change' (length=19)
'result' => boolean true
'request' =>
array (size=4)
'token' => string 'some-token' (length=10)
'password' => string '130d04b8123456857e47b254ebfbb53f' (length=32)
'comman 'cmd' => string 'subscription.change' (length=19)
'data' =>
array (size=7)
'item_id' => int 1string '20004' (length=5)
'pp_type' => string 'RG' (length=2)
'next_rebill_date' => string '2013-105-04-30' (length=10)
'rebill_unit' => string 'month' (length=5)
'rebill_period' => int 1string '1' (length=1)
'next_rebill_amount' => float string '9.99' (length=4)
'rebill_amount' => string '29.99' (length=5)
'rebill_amount' => float 29.99'token' => string 'some-token' (length=26)
't 'pass' => int 1382553121string 'some-pass' (length=32)
'origin_ip 'ts' => boolean falseint 1429562351
'debug 'origin_ip' => nullstring '93.87.220.184' (length=13)
'errors' => null
```