1. Go to this page and download the library: Download ambitionphp/laravel-bitpay 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/ */
ambitionphp / laravel-bitpay example snippets
namespace App\Listeners;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Vrajroham\LaravelBitpay\Events\BitpayWebhookReceived;
class ProcessBitpayWebhook
{
/**
* Create the event listener.
*/
public function __construct()
{
}
/**
* Handle the event.
*
* @param object $event
*/
public function handle(BitpayWebhookReceived $event)
{
$orderId = $event->payload['orderId'];
$status = $event->payload['status'];
// Other payload properties
// You will receive 3 webhooks for single payment with different status.
// 1. status = paid
// 2. status = confirmed
// 3. status = completed
}
}
class EventServiceProvider extends ServiceProvider{
protected $listen = [
// Other events and listeners
BitpayWebhookReceived::class => [
ProcessBitpayWebhook::class,
],
];
public function boot()
{
parent::boot();
}
}