subscription.change
subscription.change
subscription.change
Description
Edit existing subscription by altering it's parameters.
Input Parameters
Name | Type | Required | Description |
---|---|---|---|
item_id | Int | Yes | PV2 item_id |
pp_type | string | Yes | PP Type (NB|RG|PO|...) |
next_rebill_date | date | No | Next Rebill date in YYYY-MM-DD format |
rebill_unit | string | Yes | Rebill Unit (day|week|month|year) |
rebill_period | int | Yes | Rebill period that will affect num of rebill unit used for rebills (i.e. 3 months) |
next_rebill_amount | float | No | Amount to be used for next rebill only |
rebill_amount | float | Yes | Amount to be used for all rebills (except for next) |
Returned
Name | Type | Description |
---|---|---|
result | boolean | True on success false on failure |
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
Referenced Files
None
Subscribers
None
- Last Author
- aplawecki
- Last Edited
- Jan 28 2020, 11:12