PHP code example of blognevis / payments

1. Go to this page and download the library: Download blognevis/payments library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

blognevis / payments example snippets


php artisan vendor:publish --tag=config

Route::get('/request-nowpayments', function () {
    $params = [
        "price_amount" => 1000,
        "price_currency" => "usd",
        "order_id" => "RGDBP-21314",
        "order_description" => "Apple Macbook Pro 2019 x 1",
        "ipn_callback_url" => "https://nowpayments.io",
        "success_url" => url('/verify-nowpayments'),
        "cancel_url" => url('/verify-nowpayments')
    ];
    $res = (new Payment('nowpayments'))->pay($params);
    return redirect($res['payment_url']);
});

Route::get('/verify-nowpayments', function () {
    $res = (new Payment('nowpayments'))->verify(request()->get('NP_id'));
    return response()->json($res);
});