Page MenuHomeDatingVIP

subscription.change
Updated 1,547 Days AgoPublic

subscription.change

Description

Edit existing subscription by altering it's parameters.

Input Parameters
NameTypeRequiredDescription
item_idIntYesPV2 item_id
pp_typestringYesPP Type (NB|RG|PO|...)
next_rebill_datedateNoNext Rebill date in YYYY-MM-DD format
rebill_unitstringYesRebill Unit (day|week|month|year)
rebill_periodintYesRebill period that will affect num of rebill unit used for rebills (i.e. 3 months)
next_rebill_amountfloatNoAmount to be used for next rebill only
rebill_amountfloatYesAmount to be used for all rebills (except for next)
Returned
NameTypeDescription
resultbooleanTrue 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
Last Author
aplawecki
Last Edited
Jan 28 2020, 11:12

Event Timeline

boris moved this document from Unknown Object (Phriction Wiki Document).Mar 11 2015, 13:31
boris changed the visibility from "Public (No Login Required)" to "All Users".
boris changed the visibility from "All Users" to "Public (No Login Required)".
boris shifted this object from the Restricted Space space to the S6 Everyone space.Aug 8 2018, 08:24