arca driver for the Omnipay Laravel payment processing library
Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.5+. This package implements ARCA support for Omnipay. With CardBinding Support
Omnipay is installed via Composer. To install, simply add it
to your composer.json
file:
{
"require": {
"tobelyan/omnipay-arca": "dev-master"
}
}
And run composer to update your dependencies:
composer update
Or you can simply run
composer require tobelyan/omnipay-arca
- Use Omnipay gateway class:
use Omnipay\Omnipay;
- Initialize ARCA gateway:
$gateway = Omnipay::create('Arca');
$gateway->setUserName(env('username'));
$gateway->setPassword(env('password'));
$gateway->setParameter('language',\App::getLocale()); // Language
$gateway->setParameter('amount',10); // Amount to charge
$gateway->setParameter('TransactionId',XXXX); // Transaction ID from your system
- Call purchase, it will automatically redirect to ARCA's hosted page
$purchase = $gateway->purchase()->send();
$purchase->redirect();
- Here we should get callback url to check status, e.g
public function checkStatus(Request $request) {
$orderId = $request->orderId;
//then make a request
$gateway = Omnipay::create('Arca');
$gateway->setUserName(env('username'));
$gateway->setPassword(env('password'));
$purchase = $gateway->getOrderStatus(['transactionId' => $request->orderId])->send();
if($purchase->isSuccessful()) {
//your logic
}
}
Card Binding
Add these methods to your logic
$gateway->setParameter('clientId', auth()->user()->id);
$gateway->setParameter('bindingPayment',true);
$gateway->setParameter('bindingId',$card->bindingId);
//Send Binding info using these methods
$gateway->setParameter('mdOrder',$orderId);
$purchase = $gateway->makeBindingPayment()->send();
//then send Redirection
if ($purchase->isRedirect()) {
$purchase->redirect();
}
Data you will get after payment
$purchaseData = [
'user_id'=>auth()->user()->id,
'expiration'=>$purchase->getData()['cardAuthInfo']['expiration'],
'cardholderName'=>$purchase->getData()['cardAuthInfo']['cardholderName'],
'approvalCode'=>$purchase->getData()['cardAuthInfo']['approvalCode'],
'pan'=>$purchase->getData()['cardAuthInfo']['pan'],
'clientId'=>$purchase->getData()['bindingInfo']['clientId'],
'bindingId'=>$purchase->getData()['bindingInfo']['bindingId'],
'secure_hash'=>md5($purchase->getData()['cardAuthInfo']['pan'])
];
For general usage instructions, please see the main Omnipay repository.
Developed BY DINEURON
If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.
If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.
If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.