I am trying to install a Coinpayment srcipt from github hexters coinpayment ,but im hitting a snag in Laravel

  laravel, php

https://github.com/hexters/CoinPayment

So i’m fine with the whole installation on my local using aamps.

composer require hexters/coinpayment done:

php artisan vendor:publish –tag=coinpayment done:

php artisan coinpayment:install done:

next though is a little confusing in the "Create Button transaction. Example placed on your controller"

Do I put all the following code in the Controller.php?

and how to I display it on say the index page?

  use HextersCoinPaymentCoinPayment;
  . . . 
  /*
  *   @required true
  */
  $transaction['order_id'] = uniqid(); // invoice number
  $transaction['amountTotal'] = (FLOAT) 37.5;
  $transaction['note'] = 'Transaction note';
  $transaction['buyer_name'] = 'Jhone Due';
  $transaction['buyer_email'] = '[email protected]';
  $transaction['redirect_url'] = url('/back_to_tarnsaction'); // When Transaction was comleted
  $transaction['cancel_url'] = url('/back_to_tarnsaction'); // When user click cancel link


  /*
  *   @required true
  *   @example first item
  */
  $transaction['items'][] = [
    'itemDescription' => 'Product one',
    'itemPrice' => (FLOAT) 7.5, // USD
    'itemQty' => (INT) 1,
    'itemSubtotalAmount' => (FLOAT) 7.5 // USD
  ];

  /*
  *   @example second item
  */
  $transaction['items'][] = [
    'itemDescription' => 'Product two',
    'itemPrice' => (FLOAT) 10, // USD
    'itemQty' => (INT) 1,
    'itemSubtotalAmount' => (FLOAT) 10 // USD
  ];

  /*
  *   @example third item
  */
  $transaction['items'][] = [
    'itemDescription' => 'Product Three',
    'itemPrice' => (FLOAT) 10, // USD
    'itemQty' => (INT) 2,
    'itemSubtotalAmount' => (FLOAT) 20 // USD
  ];

  $transaction['payload'] = [
    'foo' => [
        'bar' => 'baz'
    ]
  ];

  return CoinPayment::generatelink($transaction);

I am new to Laravel though im learning about the structure this one has me stumped as it has little details but it looks like a great script to learn from!

The next ones have even less but they don;t look to be required!

Listening status transaction

Open the Job file AppJobsCoinpaymentListener for the listen the our transaction and proccess

Manual check without IPN

This function will execute orders without having to wait for the process from IPN

We can also make cron to run this function if we don’t use IPN

use HextersCoinPaymentCoinPayment;

. . .

/**
* this is triger function for running Job proccess
*/
return CoinPayment::getstatusbytxnid("CPDA4VUGSBHYLXXXXXXXXXXXXXXX");
// output example: "celled / Timed Out"
Get histories transaction Eloquent
use HextersCoinPaymentCoinPayment;

. . .

CoinPayment::gettransactions()->where('status', 0)->get();

I am stumped even a suggestion pointing in the right place would be appreciated!
I rarely come to ask I spent a day and a half on this but to no avail!

Source: Laravel

Leave a Reply