GithubHelp home page GithubHelp logo

revlenuwe / gearer Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 18 KB

MyceliumGear gateway payment processing

License: MIT License

PHP 100.00%
laravel gateway gateway-api laravel-gateway cryptocurrency bitcoin

gearer's Introduction

MyceliumGear gateway Laravel

GEAR

Implementation MyceliumGear gateway payment processing support for Laravel

For more information check Mycelium Gear

Installation

Via Composer

$ composer require revlenuwe/gearer

Register the service provider and facade if you work with Laravel 5.4:

// config/app.php

'providers' => [
    ...
    Revlenuwe\Gearer\GearerServiceProvider::class,
];


'aliases' => [
    ...
    Revlenuwe\Gearer\Facades\Gearer::class,
];

For Laravel 5.5+ they will be registered automatically

You can publish the gearer.php config with:

$ php artisan vendor:publish --provider="Revlenuwe\Gearer\GearerServiceProvider"

Usage

Creating order:
$order = Gearer::createOrder($amount, $lastKeyChainId);
Canceling order:
$result = Gearer::cancelOrder($orderOrPaymentId);
Receiving Last Keychain ID:
$lastKeyChainId = Gearer::getLastKeychainId();

// 1
Checking Order Status Manually:
$orderData = Gearer::checkOrderStatusManually($paymentId);

/*
{
  "status": 2,
  "amount": 7894000,
  "address": "1NZov2nm6gRCGW6r4q1qHtxXurrWNpPr1q",
  "transaction_ids": ["f0f9205e41bf1b79cb7634912e86bb840cedf8b1d108bd2faae1651ca79a5838"],
  "id": 1,
  "payment_id": "y78033435ea02f024f9abdfd04adabe314a322a0d353c33beb3acb7d97f1bdeb",
  "amount_in_btc": "0.07894",
  "amount_paid_in_btc": "0.07894",
  "keychain_id": 3,
  "last_keychain_id": 3
}
*/
Order Websocket URL:
$websocketUrl = Gearer::getOrderWebsocketUrl($orderId);


// https://gateway.gear.mycelium.com/gateways/:api_gateway_id/orders/:orderId:/websocket
Receiving Order Status Change Callback:
public function handleCallback(Request $request)
{
    //Passing $request is optional
    $order = Gearer::handleOrderStatusCallback($request);

    if($order !== false){
        /*
        [
          "status": 2,
          "amount": 7894000,
          "address": "1NZov2nm6gRCGW6r4q1qHtxXurrWNpPr1q",
          "transaction_ids": ["f0f9205e41bf1b79cb7634912e86bb840cedf8b1d108bd2faae1651ca79a5838"],
          "id": 1,
          "payment_id": "y78033435ea02f024f9abdfd04adabe314a322a0d353c33beb3acb7d97f1bdeb",
          "amount_in_btc": "0.07894",
          "amount_paid_in_btc": "0.07894",
          "keychain_id": 3,
          "last_keychain_id": 3
        ]
        */
    }
}
Setting config on the fly:
$gearer = Gearer::setConfig($gatewayId, $gatewaySecret);

$lastKeychainId = $gearer->getLastKeychainId();

License

The MIT License (MIT). Please see License File for more information.

gearer's People

Contributors

revlenuwe avatar

Watchers

 avatar

Forkers

dariusiii

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.