PHP code example of mintance / ipsp-php

1. Go to this page and download the library: Download mintance/ipsp-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mintance / ipsp-php example snippets




define('MERCHANT_ID' , 'your_merchant_id');
define('MERCHANT_PASSWORD' , 'test');
define('IPSP_GATEWAY' , 'your_ipsp_gateway');

$client = new Ipsp\Client( MERCHANT_ID , MERCHANT_PASSWORD, IPSP_GATEWAY );
$ipsp   = new Ipsp\Api( $client );



function getSignature( $merchant_id , $password , $params = array() ){
 $params['merchant_id'] = $merchant_id;
 $params = array_filter($params,'strlen');
 ksort($params);
 $params = array_values($params);
 array_unshift( $params , $password );
 $params = join('|',$params);
 return(sha1($params));
}



$order_id = 'testproduct10002';

$data = $ipsp->call('checkout',array(
 'order_id'    => $order_id,
 'order_desc'  => 'Short Order Description',
 'currency'    => $ipsp::USD ,
 'amount'      => 2000, // 20 USD
 'response_url'=> sprintf('http://shop.example.com/checkout/%s',$order_id)
))->getResponse();

// redirect to checkoutpage
header(sprintf('Location: %s',$data->checkout_url));

$data = $ipsp->call('checkout',array());

$data = $ipsp->call('pcidss',array());

$data = $ipsp->call('recurring',array());

$data = $ipsp->call('reports',array());

$data = $ipsp->call('reverse',array());

$data = $ipsp->call('status',array());

$data = $ipsp->call('verification',array());

$data = $ipsp->call('capture',array());

$data = $ipsp->call('p2pcredit',array());
cmd
composer