Require the package using composer:
composer require arbory/omnipay-everypay
$gateway = Omnipay::create('EveryPay')->initialize([
'username' => '', // EveryPay api username
'secret' => '', // EveryPay api secret
'accountName' => '', // merchant account name
'gatewayUrl' => 'https://igw-demo.every-pay.com/api/v3', // use merchant provided url for production
]);
$authorize = $gateway
->authorize([
'amount' => '1.28',
'transactionId' => uniqid(),
'email' => '[email protected]',
'customerIp' => '1.2.3.4',
'callbackUrl' => 'https://shop.example.com/cart',
'customerUrl' => 'https://shop.example.com/cart'
]);
$response = $authorize->send();
// Gateway transaction reference
$response->getTransactionReference();
return $response->redirect(); // this will call redirect to payment portal
EveryPay will return to your callback url with a GET
request once the payment is finalized.
You need to validate this response and check if the payment succeeded.
// Here, pass the payment array that we previously stored when creating the payment
$response = $gateway->completeAuthorize(['transactionReference' => 'foo')->send();
if ($response->isSuccessful()) {
// Payment succeeded!
}
// Payment succeeded!
// Here's your payment reference number: $response->getTransactionReference()