PHP code example of alejobit / placetopay-pse-php

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

    

alejobit / placetopay-pse-php example snippets


use PlacetoPay\PSE\PSE;

$pse = new PSE($login, $tranKey);

$pse->setCacheAdapter(CacheItemPoolInterface $cacheAdapter);

$bankList = $pse->getBankList();

$transaction = $pse->createTransaction();
$multiCreditTransaction = $pse->createTransactionMultiCredit();

$transaction->setBankCode($bank->getCode());
$transaction->setBankInterface(Bank::PERSONAL_INTERFACE);
$transaction->setReturnURL('https://www.placetopay.com');
$transaction->setReference(md5('reference'));
$transaction->setDescription('Description of transaction');
$transaction->setLanguage('ES');
$transaction->setCurrency('COP');
$transaction->setTotalAmount(12345.6);
$transaction->setTaxAmount(0.0);
$transaction->setDevolutionBase(0.0);
$transaction->setTipAmount(0.0);
$transaction->setPayer(array(
    'documentType' => 'CC',
    'document' => '123456789',
    'firstName' => 'Foo',
    'lastName' => 'Bar',
    'company' => 'PlacetoPay',
    'emailAddress' => '[email protected]',
    'address' => 'Calle 53 No. 45 – 112 OF. 1901',
    'city' => 'Medellín',
    'province' => 'Antioquia',
    'country' => 'CO',
    'phone' => '+57 (4) 444 2310',
    'mobile' => '+57 (4) 444 2310',
));
$transaction->setIpAddress('127.0.0.1');
$transaction->addAdditionalData('name', 'value');

$multiCreditTransaction->addCreditConcept(array(
    'entityCode'=> '123456',
    'serviceCode' => '654321',
    'amountValue' => 12345.6,
    'taxValue' => 0.0,
    'description' => 'Description of credit concept',
));

$response = $transaction->send()

$transactionInfo = $pse->getTransactionInformation($response->getTransactionId());
bash
composer