Giter Site home page Giter Site logo

coinpayment's Introduction

CoinPayment

Latest Stable Version Total Downloads License

CoinPayment is a Laravel module for handling transactions from CoinPayment like a create transaction, history transaction, etc. Example

Requirement

  • Laravel ^5.6
  • PHP >= ^7.1
  • GuzzleHttp
  • Nesbot/Carbon

Installation

You can install the package via composer:

$ composer require hexters/coinpayment

Publishing vendor

$ php artisan vendor:publish --tag=coinpayment-publish

First you should add trait class on User model and use this trait Hexters\CoinPayment\Entities\CoinPaymentuserRelation check the example below:

    <?php
        namespace App;

        use Illuminate\Notifications\Notifiable;
        use Illuminate\Foundation\Auth\User as Authenticatable;
        use Hexters\CoinPayment\Entities\CoinPaymentuserRelation;

        class User extends Authenticatable {
            use Notifiable, CoinPaymentuserRelation;
            ...

Install CoinPayment configuration

$ php artisan coinpayment:install

Setting schedule for checking if transaction succeeded in your file app > console > kernel. example:

...
    protected function schedule(Schedule $schedule) {
        // If IPN is enable set the schedule for ->daily()
        // And if IPN is disable set schedule for ->everyMinute()
         $schedule->command('coinpayment:transaction-check')
            ->daily();

    }
...

visit the Documentation Schedule

Install the table transaction

$ php artisan migrate

Installation finish.

Getting Started

Create Button transaction. Example placed on your controller

use CoinPayment; // use outside the class
...
    /*
    *   @required true
    */
    $trx['amountTotal'] = 50; // USD
    $trx['note'] = 'Note for your transaction';

    /*
    *   @required true
    *   @example first item
    */
    $trx['items'][0] = [
        'descriptionItem' => 'Product one',
        'priceItem' => 10, // USD
        'qtyItem' => 2,
        'subtotalItem' => 20 // USD
    ];

    /*
    *   @example second item
    */
    $trx['items'][1] = [
        'descriptionItem' => 'Product two',
        'priceItem' => 10, // USD
        'qtyItem' => 3,
        'subtotalItem' => 30 // USD
    ];

    /*
    *   if you want to remember your data at a later date, you can add the parameter below
    */
    $trx['payload'] = [
        // your custom array here
        'foo' => [
            'foo' => 'bar'
        ]
    ];

    $link_transaction = CoinPayment::url_payload($trx);
    ...
    /*
    *   On your blade
    *   <a href="{{ $link_transaction }}" target="_blank">Pay Now</a>
    */
...

Please except the route from csrf process in the file app > Http > Middleware > VerifyCsrfToken.php

    ...
    protected $except = [
        ...
        '/coinpayment/ipn'
        ...
    ];
    ...

Open file app > Jobs > coinPaymentCallbackProccedJob.php for handling transaction process

And Open app > Jobs > IPNHandlerCoinPaymentJob.php for handling IPN process

Route Access

Route Name Route URL Method Description
coinpayment.transaction.histories /transactions/histories GET Route for access transaction histories

Give me a coffee

BTC: 1388MHjeHmq6kUC7WpSS6pPtgG7hm7fCau

coinpayment's People

Contributors

hexters avatar evgeny-barinov avatar avonnadozie avatar

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.