paysterify / paysterify
There is no license information available for the latest version (0.1.0) of this package.
0.1.0
2018-02-25 20:51 UTC
Requires
- guzzlehttp/guzzle: 6.3.*
This package is not auto-updated.
Last update: 2024-04-28 03:30:44 UTC
README
payment gateways for Laravel
Example
$config = [ // Required.. 'amount' => '2.50', 'currency' => 'USD', // Optional.. 'sandbox' => true, 'description' => 'hosting credits', // Depends on the gateway requirements.. 'client' => env('PAYPAL_CLIENT'), 'secret' => env('PAYPAL_SECRET'), 'url_return' => url('/paypal/return'), 'url_cancel' => url('/paypal/cancel'), ]; use Illuminate\Http\Request; use \Facades\Paysterify\Paysterify; Route::get('/paypal', function () use ($config) { $paysterify = Paysterify::gateway('paysterify.paypal')->configure($config)->purchase(); if ($paysterify->isRedirect()) { return $paysterify->redirect(); } }); Route::get('/paypal/return', function (Request $request) use ($config) { $paysterify = Paysterify::gateway('paysterify.paypal')->configure($config)->completePurchase([ 'paymentId' => $request->get('paymentId'), 'payerId' => $request->get('PayerID'), ]); if ($paysterify->isCompleted()) { echo 'Thanks for your payment.'; } else { echo 'Something went wrong, payment is not completed.'; } });
This is a very basic paypal example, you will be able to use the almost same code for multiple gateways with some minor tweaks.