paint-brush
Paypal Integration Package Built With PHPby@epmnzava
149 reads

Paypal Integration Package Built With PHP

by epmnzavaSeptember 28th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The package is built on PHP Laravel framework. It can be found on GitHub and can be downloaded from the repository. The package can be installed via composer using the composer. It is available to use in production and test environments for the latest Laravel version of 7.1.1. There is a short documentation of how to install and use the package with the help of epmnzava.

Company Mentioned

Mention Thumbnail
featured image - Paypal Integration Package Built With PHP
epmnzava HackerNoon profile picture

Due to the high demand in requests for PayPal integration in some of the projects that I am working on, I decided to build a component package. This package is built on the PHP Laravel framework.

The package can be found on github https://github.com/dbrax/paypal-laravel.

Here is a short documentation of how to install and use the package:

How the package communicates with PayPal

Installation

Laravel Version: => 7.1PHP Version: => 7.1

You can install the package via composer:

composer require epmnzava/paypal-laravel

Update your config (for Laravel 5.4 and below)

Add the service provider to the providers array in config/app.php:

"Epmnzava\PaypalLaravel\PaypalLaravelServiceProvider"::class

Add the facade to the aliases array in config/app.php:

'Paypal'=>Epmnzava\PaypalLaravel\PaypalLaravelFacade::class,

Publish the package configuration (for Laravel 5.4 and below)

Publish the configuration file and migrations by running the provided console command:

php artisan vendor:publish --provider="Epmnzava\PaypalLaravel\PaypalLaravelServiceProvider"

Environmental Variables

  • PAYPAL_CLIENT_ID
     your provided paypal client id.
  • PAYPAL_CLIENT_SECRET
     your provided paypal client secret.
  • PAYPAL_REDIRECT_URL
     your redirect url.
  • PAYPAL_CANCEL_URL
     your cancel url.
  • PAYPAL_ENVIRONMENT
     your environment either test or production.
  • PAYPAL_CURRENCY_CODE
     currency put TZS for Tanzanian Shillings.
  • PAYPAL_ORG_NAME
     your organization name.

Usage

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Paypal;
class TestController extends Controller
{
    
    public function simplepay_by_paypal(){
$response=Paypal::CreatePayment("5","0","0","1","Payment for basket ball");
    $payment_id=$response["order_id"];
return redirect($response["checkout_link"]);

If you have faced any errors or issues please let me know: mail [email protected].

Cheers!