phuongdev89/omnipay-anymoney

Any.Money driver for the Omnipay payment processing library

dev-master 2023-01-10 15:46 UTC

This package is not auto-updated.

Last update: 2024-11-17 19:34:24 UTC


README

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

Installation

The preferred way to install this library is through composer.

Either run

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

or add

"phuongdev89/omnipay-anymoney": "*"

to the require section of your composer.json file.

Usage

The following gateways are provided by this package:

Init Any.Money

    $gateway = \Omnipay\Omnipay::create(\Omnipay\AnyMoney\Gateway::NAME);
    $gateway->initialize([
        'api_key'  => $API_KEY,
        'merchant' => $MERCHANT,
    ]);

Authentication

Detail: https://docs.any.money/en/auth/

Get Balance

    $balance = $gateway->balance(['curr'=>'USD'])->send();
    if($balance->isSuccessful()){
        var_dump($balance->getResult());
    } else {
        var_dump($balance->getError());
        var_dump($balance->getMessage());
    }

Invoice

Detail: https://docs.any.money/en/invoice/

Create invoice

    $invoice = $gateway->invoice([
        'amount'     => 10,
        'externalid' => '1001',//must be unique each call
        'in_curr'    => 'USD',
    ])->create();
    if($invoice->isSuccessful()){
        var_dump($balance->getRedirectUrl());
        var_dump($balance->getData());
    } else {
        var_dump($balance->getError());
        var_dump($balance->getMessage());
    }

Calc invoice

    $invoice = $gateway->invoice([
        'amount'     => 10,
        'in_curr'    => 'USD',
    ])->calc();
    if($invoice->isSuccessful()){
        var_dump($balance->getResult());
    } else {
        var_dump($balance->getError());
        var_dump($balance->getMessage());
    }

Get invoice

    $invoice = $gateway->invoice([
        'externalid' => '1001',
    ])->get();
    if($invoice->isSuccessful()){
        var_dump($balance->getResult());
    } else {
        var_dump($balance->getError());
        var_dump($balance->getMessage());
    }

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.