<?php
/*
 * TEST SOAP ABO
 * 
 * */
 date_default_timezone_set("Europe/Paris");
 
$wsdl = 'https://test-ws.hipay.com/soap/subscription?wsdl';
$initArray = array(

  'wsLogin' => '4f8c3e80fd4e476f1e227c68fefdb3e5',
  'wsPassword' => '2f0c4099c4254f819bf7246d6202d192',
  'websiteId' => 345,
  'categoryId' => 225,
  'customerEmail' => 'mymail@sample.com',
);

$options = array(
                'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP,
                'cache_wsdl' => WSDL_CACHE_NONE,
            );

            $client = new SoapClient($wsdl, $options);
            $result = $client->process($initArray + array(
                    'currency' => 'EUR',
                    'rating' => 'ALL',
                    'locale' => 'en_GB',
                    'label' => 'Test subscription', //'Abonnement web service',
                    'customerIpAddress' => $_SERVER['REMOTE_ADDR'], //$_SERVER['REMOTE_ADDR'],
                    'merchantReference' => 'REF-ABO15', // 'REF-ABO15',
                    'urlCallback' => 'http://hipay.com/', // 'http://www.example.com/callback',

                    'urlAccept' => 'http://hipay.com/?response=ok',
                    'urlDecline' => 'http://hipay.com/?response=nok',
                    'urlCancel' => 'http://hipay.com/?response=cancel',

                    'payments' => array(
                    	'initial' => array(
                            'name' => 'My Product',
                            'description' => '',
                            'amount' => 29.99,
                            'recurrence' => array(
                                'frequency' => 1,
                                'duration' => 'month',
                            ),
                            'periodType' => 'free',
                            'freePeriod' => array(
                                'length' => 3,
                                'timeUnit' => 'month',
                            ),
                        ),
                        'rebill' => array(
                            'name' => 'My product',
                            'description' => 'monthly subscription',
                            'amount' => '29.99',
                            'executionTimestamp' => date('c', strtotime("+3 months", strtotime(date('c')))),
                        ),
                    ),
             	)
             );
//var_dump($result);             
          
print_r($result);
?>