1. Go to this page and download the library: Download mongosprout/paymongo-bridge 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/ */
use MongoSprout\PayMongo\Webhooks\Events\SubscriptionInvoicePaid;
class GrantAccess
{
public function handle(SubscriptionInvoicePaid $event): void
{
$invoice = Invoice::find($event->metadata('invoice_id'));
// Handlers must be safe to run twice. PayMongo redelivers.
$invoice?->markPaid($event->resource()->centavos());
}
}