Wallogit.com
2017 © Pedro Peláez
PlaceToPay SDK for PHP
PlaceToPaySDK For PHP, (*1)
Install using composer, (*2)
composer require julianmc90/place-to-pay-sdk:dev-master@dev
Require this autoload, (*3)
require_once __DIR__ . '/vendor/autoload.php'; use PlaceToPay\PlaceToPay;
Create and configure a PlaceToPay Object, (*4)
/**
* Setting PlaceToPay Object
* @var PlaceToPay
*/
$placeToPay = new PlaceToPay([
/**
* Web service Url
*/
'wsdl' => 'https://test.placetopay.com/soap/pse/?wsdl',
/**
* Login
*/
'login' => '6dd490faf9cb87a9862245da41170ff2',
/**
* Transactional Key
*/
'tranKey'=> '024h1IlD',
/**
* Timezone (Optional) defaults to America/Bogota
*/
//'timeZone' => ''
]);
To get the bank list, this is loaded from cahe and refreshed each day, (*5)
$placeToPay->getBankList();
/**
* payer, buyer and shipping follows the next format
* @var Array
*/
$payer = Array(
'document' => '',
'documentType' => '',
'firstName' => '',
'lastName' => '',
'company' => '',
'emailAddress' => '',
'address' => '',
'city' => '',
'province' => '',
'country' => '',
'phone' => '',
'mobile' => ''
);
Additional data, (*6)
/** * Additional data follows the next format * @var array */ $additionalData = Array(); /** * could be added more indexes to fit your needs */ $additionalData[] = ['name'=>'', 'value'=>''];
The transaction request need the following information, (*7)
/**
* To set the Transaction request
* follow this format
*/
$placeToPay->setPseTransactionRequest([
'bankCode' => '',
'bankInterface' => '',
'returnURL' => '',
'reference' => '',
'description' => '',
'language' => '',
'currency' => '',
'totalAmount' => 0,
'taxAmount' => 0,
'devolutionBase'=> 0,
'tipAmount' => 0,
'payer' => $payer,
'buyer' => $buyer,
'shipping' => $shipping,
'additionalData'=> $additionalData
]);
Create and send the transaction, (*8)
$placeToPay->createTransaction();
// Get transaction information
/**
* needs a transaction identifier
* @type {Number}
*/
$identifier = 1234;
$placeToPay->getTransactionInformation($identifier);
Needs Credits to be setup, (*9)
/**
* Credits follows the next format
* @var array
*/
$credits = [];
/**
* could be added more indexes to fit your needs
*/
$credits[] = [
'entityCode' =>'',
'serviceCode' =>'',
'amountValue' =>0,
'taxValue' => 0,
'description' =>''
];
The transaction multicredit request needs the following information, (*10)
$placeToPay->setPseTransactionMultiCreditRequest([
'bankCode' => '',
'bankInterface' => '',
'returnURL' => '',
'reference' => '',
'description' => '',
'language' => '',
'currency' => '',
'totalAmount' => 0,
'taxAmount' => 0,
'devolutionBase'=> 0,
'tipAmount' => 0,
'payer' => $payer,
'buyer' => $buyer,
'shipping' => $shipping,
'additionalData'=> $additionalData,
'credits' => $credits
]);
Creates and gets the transaction response, (*11)
$placeToPay->createTransactionMultiCredit();
This is made for a testing my skills for PlaceToPay company, (*12)