PHP code example of misavan / boipa_php_sdk

1. Go to this page and download the library: Download misavan/boipa_php_sdk 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/ */

    

misavan / boipa_php_sdk example snippets


$payments = (new Payments())->testEnvironment(array(
  ‘merchantId’ => ‘42’, 
  ‘password’ => ‘mypassword’));
	
$payments = (new Payments())->productionEnvironment()->
  merchantId(‘42’)->
  password(‘mypassword’);

Config::$ProductionUrls["SessionTokenRequestUrl"] = Some.url;

$payments = (new Payments())->productionEnvironment()->
merchantId(‘42’)->
password(‘mypassword’);

	$newPurchase = $payments->purchase();

$newPurchase = $payments->purchase(array(
  ‘number’ => ‘42’,
  ‘nameOnCard’ => ‘Alice’,
  …)); 

	$newPurchase = $payments->purchase()->
		number(‘42’)->
		nameOnCard(‘Alice’)->
..<and so on>;
	
try {
		$myRequest->execute(function($res) {
			// do something with $res
		});
	} catch(Payments/PaymentsException e) {
	// something went wrong, did you configure your request properly?
} 

	try {
		$res = $myRequest->execute();
		// do something with $res
	} catch(Payments/PaymentsException e) {
		// something went wrong, did you configure your request properly?
	}
	
	$myMerchantId = $payments->merchantId(); 
	
	$samePaymentsObject = $payments->password(‘myPassword’);

	$currentPaymentAmount = $paymentRequest->$amount;

	$paymentRequest->$amount = ‘42.00’;

	$transactionToRefund = $refundRequest[‘originalMerchantTxId’];

	$refundRequest[‘originalMerchantTxId’] = 42;

	$payments = new Payments($myConfigOpts);
	$refundRequest = $payments->refund($myRefundOpts);

	$refundRequest = $payments->refund();
	$refundRequest($myRefundOpts);

	$payments = new Payments();
	$paymentsTest = $payments->testEnvironment($myConfigOpts);
	$paymentsProduction = $payments->productionEnvironment($myConfigOpts);

	$payments = (new Payments())->productionEnvironment($myConfigOptions);

	$myAuth = $payments->auth($myAuthOptions);

	$myCapture = $payments->capture($myCaptureOptions);

	$myVoid = $payments->void($myVoidOptions);

	$myPurchase = $payments->purchase($myPurchaseOptions);

	$myRefund = $payments->refund($myRefundOptions);

	$myStatusCheck = $payments->statusCheck($myStatusCheckOptions);

	try {
		// without a callback
		$myPurchaseResult = $myPurchase->execute();

		// or with a callback
		$myPuchase->execute(function($res) {
			// do something here
		});
} catch(Payments/Exception e) {
	// don’t forget to check for errors!
}

$myObject = $myObject->
myParamA(‘valueA’)->
myParamB(‘valueB’)->
myParamC(‘valueC’)->
myParamD(‘valueD’)->
… and so on for as long as you like … ;