nekofar / omnipay-yekpay

Yekpay driver for the Omnipay PHP payment processing library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Omnipay: Yekpay

Yekpay driver for the Omnipay PHP payment processing library

Packagist Version PHP from Packagist Travis (.com) branch Codecov Packagist Twitter: nekofar

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP. This package implements Yekpay support for Omnipay.

Installation

Omnipay is installed via Composer. To install, simply require league/omnipay and nekofar/omnipay-yekpay with Composer:

composer require league/omnipay nekofar/omnipay-yekpay

Basic Usage

The following gateways are provided by this package:

  • Yekpay

For general usage instructions, please see the main Omnipay repository.

Example

Purchase

The result will be a redirect to the gateway or bank.

use Omnipay\Omnipay;

$gateway = Omnipay::create('Yekpay');
$this->gateway->setMerchantId('XXXXXXXXXXXXXXXXXXXX');
$this->gateway->setReturnUrl('https://example.com/callback.php');

// Send purchase request
$response = $gateway->purchase([
    'amount' => 799.00,
    'fromCurrencyCode' => 978,
    'toCurrencyCode' => 364,
    'orderNumber' => 125548,
    'firstName' => 'John',
    'lastName' => 'Doe',
    'email' => 'test@example.com',
    'mobile' => '+44123456789',
    'address' => 'Alhamida st Al ras st',
    'postalCode' => '64785',
    'country' => 'United Arab Emirates',
    'city' => 'Dubai',
    'description' => 'Apple mac book air 2017',
])->send();

// Process response
if ($response->isRedirect()) {
    // Redirect to offsite payment gateway
    $response->redirect();
} else {
    // Payment failed: display message to customer
    echo $response->getMessage();
}

On return, the usual completePurchase will provide the result of the transaction attempt.

The final result includes the following methods to inspect additional details:

// Send purchase complete request
$response = $gateway->completePurchase([
    'authority' => $_REQUEST['authority'], 
)->send();

// Process response
if ($response->isSuccessful()) {
    // Payment was successful
    print_r($response);
} else {
    // Payment failed: display message to customer
    echo $response->getMessage();
}

Testing

composer test

Support

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.

About

Yekpay driver for the Omnipay PHP payment processing library

License:MIT License


Languages

Language:PHP 100.0%