PHP code example of lemonstand / omnipay-beanstream
1. Go to this page and download the library: Download lemonstand/omnipay-beanstream 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/ */
lemonstand / omnipay-beanstream example snippets
$gateway = Omnipay::create('Beanstream');
$gateway->setMerchantId('[MERCHANT_ID]');
$gateway->setApiPasscode('[API_PASSCODE]');
try {
$params = array(
'amount' => 10.00,
'card' => $card,
'payment_method' => 'card'
);
$response = $gateway->purchase($params)->send();
if ($response->isSuccessful()) {
// successful
} else {
throw new ApplicationException($response->getMessage());
}
} catch (ApplicationException $e) {
throw new ApplicationException($e->getMessage());
}