Search by

paysterify / paysterify

cornex

There is no license information available for the latest version (0.1.0) of this package.

Package info

github.com/paysterify/paysterify

pkg:composer/paysterify/paysterify

Statistics

Installs: 72

Dependents: 2

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0 2018-02-25 20:51 UTC

This package is not auto-updated.

Last update: 2026-10-11 16:24:26 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.