park-holidays-uk / omnipay-verifone
WIP Verifone (Commidea) Package for Omnipay (on-site payment gateway), using Chris Yallop's code: https://github.com/adnamsplc/verifone
Installs: 3 102
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- omnipay/common: ~2.0
- zendframework/zend-soap: ^2.6
This package is not auto-updated.
Last update: 2020-01-24 16:23:41 UTC
README
Verifone (Commidea) Package for Omnipay
Send settings to the gateway with the usual Omnipay setSetting('value') methods.
Example of use:
Set up gateway and card
use Omnipay\Omnipay;
use Omnipay\Common\CreditCard;
class WhateverController extends Controller
{
//Set up gateway
$verifone = Omnipay::create('Verifone');
$cardDetails = [
'title' => 'Mr',
'firstName' => 'Loopy',
'surname' => 'Rabbit',
'number' => '1234123412341234',
'cvv' => '927',
'expiryMonth' => '6',
'expiryYear' => '18'
];
//Create card
$card = new CreditCard($cardDetails);
$transactionId = '123456'; //Create a transaction id
$amount = '1'; //How much is payment for?
//Validate card (will return an error response if invalid, with some error details)
$validateResult = $card->validate();
Method 1: Authorize and capture separately:
//Authorise
$response = $verifone->authorize([
'card' => $card,
'amount' => $amount,
'transactionId' => $transactionId
])->send();
if($response->isSuccessful())
{
//Capture
$transactionResponse = $verifone->capture($response)->send();
if($transactionResponse->isSuccessful())
{
return $transactionResponse->getData();
}
//If capture not successful
return $transactionResponse->getMessage();
}
return $response->getMessage();
Method 2: Authorise and capture in one go:
$transactionResponse = $verifone->purchase([
'card' => $card,
'amount' => $amount,
'transactionId' => $transactionId
])->send();
if($transactionResponse->isSuccessful())
{
return $transactionResponse->getData();
}
return $transactionResponse->getMessage();