skygdi/paypal

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

include donation demo

1.0.6 2018-05-07 18:40 UTC

This package is not auto-updated.

Last update: 2024-04-22 05:43:22 UTC


README

Quick paypal button deploy for Laravel

1.Install:

composer require skygdi/paypal

2.Add paypal configuration into your .env file:

PAYPAL_SANBOX_CLIENTID=your_paypal_client_ID
PAYPAL_SANBOX_CLIENTSECRET=your_paypal_client_secret
PAYPAL_CLIENTID=your_paypal_client_ID
PAYPAL_CLIENTSECRET=your_paypal_client_secret
PAYPAL_ENV=sandbox

[ sandbox production ]

3.Public button template:

php artisan vendor:publish --provider="skygdi\paypal\PayPalProvider"

4.include the template partial where ever you wanted and edit as needed:

@include('vendor.skygdi.paypal_button')

Change the #order_id input and #order_total value as your logic needed before clicking the paypal checkout button.

  1. Create your order status logic, for example in web.php:
use Session;
use Illuminate\Http\Request;
use skygdi\paypal\CommonController;

Route::post('paypal/execute', function (Request $request) {
	$obj = new \skygdi\paypal\CommonController();

	$obj->InitializeApiContext();
    if( Session::has('ordering_id') ){
    	//Mark order as paying
    }

    if( !$request->has("paymentID") || !$request->has("payerID") ) return ["state"=>"error","text"=>"parameter required"];

    $p = $obj->Execute($request);
    if( isset($p->state) && $p->state=="approved" ){
    	//Mark order as finished
		return ["state"=>"success"];
    }
    else{
    	return $p;
    }
});

Quick test url:

yourURL/skygdi/paypal/test

test5