PHP code example of b2pagos / sdk

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

    

b2pagos / sdk example snippets


use B2Pagos\B2PClient;

$client = new B2PClient([
    'accountKey' => 'tu-account-key',
    'integrityKey' => 'tu-integrity-key',
    'username' => '[email protected]',
    'password' => 'tu-password',
    'apiUrl' => 'https://sandbox.b2pagos.com',
    'verifySSL' => false // true en producción
]);

$transaction = $client->createTransaction([
    'accountId'   => 'acct_123',
    'reference'   => 'ref_456',
    'description' => 'Compra online',
    'amount'      => 10000,
    'taxValue'    => 0,
    'taxBase'     => 0,
    'currency'    => 'COP'
]);

print_r($transaction);