2017 © Pedro Peláez
 

library place-to-pay-sdk

PlaceToPay SDK for PHP

image

julianmc90/place-to-pay-sdk

PlaceToPay SDK for PHP

  • Saturday, January 14, 2017
  • by julianmc90
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PlaceToPaySDK

PlaceToPaySDK For PHP, (*1)

Requirements

  • ext-soap
  • memcached

Installation

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' => ''
    ]);

Getting Bank List

To get the bank list, this is loaded from cahe and refreshed each day, (*5)

$placeToPay->getBankList();

Setting up a PSE Transaction Request

/**
 * 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);

Setting up a PSE Transaction MultiCredit Request

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();

Note

This is made for a testing my skills for PlaceToPay company, (*12)

The Versions

14/01 2017

dev-master

9999999-dev

PlaceToPay SDK for PHP

  Sources   Download

The Requires

  • php >=5.4.0