webtoucher/omnipay-anymoney

Any.Money driver for the Omnipay payment processing library

1.0.0 2020-02-11 03:45 UTC

This package is auto-updated.

Last update: 2024-04-06 09:20:23 UTC


README

Any.Money payment processing driver for the Omnipay PHP payment processing library.

Latest Stable Version Total Downloads Daily Downloads Latest Unstable Version License

Installation

The preferred way to install this library is through composer.

Either run

$ php composer.phar require webtoucher/omnipay-anymoney "*"

or add

"webtoucher/omnipay-anymoney": "*"

to the require section of your composer.json file.

Usage

The following gateways are provided by this package:

  • Any.Money
    $gateway = \Omnipay\Omnipay::create('AnyMoney');
    $gateway->setMerchantId('[MERCHANT_ID]');
    $gateway->setPrivateKey('[PRIVATE_KEY]');
    $this->gateway->setLogger(function ($message, $level = 'info') {
        // Your log handler
    });

The first step is prepairing data and redirecting to Any.Money.

    $request = $gateway->purchase([
        'amount' => 100.5,
        'currency' => 'UAH',
        'transactionId' => '100500',
        'isMultiPay' => false,
        'payway' => 'visamc_m',
        'email' => 'user@email.com',
        'notifyUrl' => 'https://notify.url',
        'returnUrl' => 'https://return.url?order=100500',
    ]);
    $response = $request->send();
    if ($response->isRedirect()) {
        $response->redirect();
    }

There is the notify request handler.

    $request = $gateway->completePurchase($_POST);
    $response = $request->send();
    $orderId = $response->getTransactionId(); // You can check this order and mark it as paid or failed.
    if ($response->isSuccessful()) {
        // Your handler
    } else {
        // Your handler
    }

On the return page you can check payment status.

    $request = $gateway->status([
        'transactionId' => $order,
    ]);
    $response = $request->send();
    if ($response->isSuccessful()) {
        // Your handler
        // Maybe you need to check here the status of the order on your side
    } else {
        // Your handler
    }

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

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.