1. Go to this page and download the library: Download beebmx/laravel-pay 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/ */
beebmx / laravel-pay example snippets
use Beebmx\LaravelPay\Payable;
class User extends Authenticatable {
use Payable;
}
use App\Models\Address;
use App\Models\Pay\User;
use App\Models\Transaction;
use App\Models\TransactionItem;
use Beebmx\LaravelPay\Pay;
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Pay::useCustomerModel(User::class);
Pay::useAddressModel(Address::class);
Pay::useTransactionModel(Transaction::class);
Pay::useTransactionItemModel(TransactionItem::class);
}
use Beebmx\LaravelPay\Address as PayAddress;
class Address extends PayAddress
{
//
}
public function driverName()
{
return "{$this->your_own_colunm_name} {$this->your_own_colunm_lastname}";
}
public function driverEmail()
{
return $this->your_own_colunm_email;
}
public function driverPhone()
{
return $this->your_own_colunm_phone;
}
use Beebmx\LaravelPay\Http\Webhooks\StripeHandler as PayStripeHandler;
class StripeHandler extends PayStripeHandler
{
// ...
}
use Beebmx\LaravelPay\Http\Webhooks\StripeHandler as PayStripeHandler;
class StripeHandler extends PayStripeHandler
{
public function handlePaymentIntentSucceeded($payload)
{
// ...
}
}
namespace App\Listeners;
use Beebmx\LaravelPay\Events\WebhookReceived;
class StripeEventListener
{
public function handle(WebhookReceived $event)
{
// $event->payload['type']
}
}
namespace App\Providers;
use App\Listeners\StripeEventListener;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Beebmx\LaravelPay\Events\WebhookReceived;
class EventServiceProvider extends ServiceProvider
{
protected $listen = [
WebhookReceived::class => [
StripeEventListener::class,
],
];
}