Use PlacetoPay PSE service in your PHP project

0.2.0 2017-08-16 12:39 UTC

This package is auto-updated.

Last update: 2021-09-25 05:31:54 UTC


Build Status StyleCI

Use PlacetoPay PSE service in your PHP project


  • XML and SOAP extensions must be enabled


Add alejobit/placetopay-pse-php as a require dependency in your composer.json file:

composer require alejobit/placetopay-pse-php

For the best operation of the client it is necessary to implement a caching library compatible with the standard PSR-6.

If your project does not have a compatible implementation, you can proceed to install the following library:

composer require symfony/cache


Create a PSE client instance, note that the $login and $tranKey are given by PlacetoPay to be able to perform transactions on behalf of a collection site

use PlacetoPay\PSE\PSE;

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

Setting the PSR-6 cache adapter instance (which must implement Psr\Cache\CacheItemPoolInterface)

$pse->setCacheAdapter(CacheItemPoolInterface $cacheAdapter);

Obtains the list of banks available for the trading establishment in the PSE system of ACH Colombia

This method returns a PlacetoPay\PSE\Struct\ArrayOfBanks object (which implements \Iterator and \Countable interfaces)

$bankList = $pse->getBankList();

Create transactions with the createTransaction() and createTransactionMultiCredit() methods:

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

Load the transaction information as follows:

$transaction->setDescription('Description of transaction');
    'documentType' => 'CC',
    'document' => '123456789',
    'firstName' => 'Foo',
    'lastName' => 'Bar',
    'company' => 'PlacetoPay',
    'emailAddress' => '',
    '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->addAdditionalData('name', 'value');

MultiCredit transactions have an additional method to add credit concepts of the same as follows

    'entityCode'=> '123456',
    'serviceCode' => '654321',
    'amountValue' => 12345.6,
    'taxValue' => 0.0,
    'description' => 'Description of credit concept',

Once loaded all the necessary data is sent the transaction with the method send()

The send() method return a PlacetoPay\PSE\Struct\PSETransactionResponse with the result of the operation

$response = $transaction->send()

To obtain the information of a specific transaction can use the method getTransactionInformation($id) passing the unique identifier of the transaction to consult

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

Related project