PHP code example of digistorm / omnipay-bpoint

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

    

digistorm / omnipay-bpoint example snippets



use Omnipay\Omnipay;
use Omnipay\Common\CreditCard;

// Create a gateway for the Bpoint Gateway
// (routes to GatewayFactory::create)
/* @var \Omnipay\Bpoint\Gateway $gateway */
$gateway = Omnipay::create('Bpoint');

$gateway->setTestMode(true);
$gateway->setUsername('usernameValue');
$gateway->setPassword('passwordValue');
$gateway->setMerchantNumber('merchantIdValue');

// Tokenize a card
/* @var \Omnipay\Bpoint\Message\Response $response */
$response = $gateway->createToken([
    'card' => new CreditCard([
        'number' => '4987654321098769',
        'cvv' => '987',
        'expiryMonth' => '03',
        'expiryYear' => '2026',
        'firstName' => 'John',
        'lastName' => 'Doe',
    ]),
    'crn1' => '12345',
    'crn2' => '',
    'crn3' => null,
])->send();

if (!$response->isSuccessful()) {
    // handle errors
}

// Charge using a token
/* @var \Omnipay\Bpoint\Message\Response $response */
$response = $gateway->purchase([
    'card' => new CreditCard([
        'number' => $response->getToken(),
        'cvv' => '987',
        'expiryMonth' => '03',
        'expiryYear' => '2026',
        'firstName' => 'John',
        'lastName' => 'Doe',
    ]),
    'amount' => '50.00',
    'currency' => 'AUD',
    'description' => 'Merchant Reference',
    'crn1' => '12345',
    'crn2' => '',
    'crn3' => null,
])->send();