PHP Classes

Laravel Paypal Integration: Access Paypal API using a Laravel service provider

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 60 All time: 10,494 This week: 455Up
Version License PHP version Categories
laravel-paypal 1.0.0Custom (specified...5PHP 5, Web services, Finances
Description 

Author

This package can access Paypal API using a Laravel service provider.

It can send HTTP requests to the Paypal API to perform several types of operations.

Currently it can retrieve the balance of a given Paypal account, as well the details transactions that were performed with that account in the last days.

Picture of Naif Alshaye
  Performance   Level  
Name: Naif Alshaye <contact>
Classes: 24 packages by
Country: Saudi Arabia Saudi Arabia
Age: ???
All time rank: 18576 in Saudi Arabia Saudi Arabia
Week rank: 195 Up2 in Saudi Arabia Saudi Arabia Up
Innovation award
Innovation award
Nominee: 9x

Documentation

Laravel PayPal Package

To communicate with PayPal API to get current balance and transactions.

Installation

composer require naif/laravel-paypal

If your Laravel below 5.5 you need to add service provider and alias to config/app.php

Naif\LaravelPayPal\LaravelPayPalServiceProvider::class,

'PayPal' => Naif\LaravelPayPal\Facades\LaravelPayPal::class,

Configuration

Publish the package config file:

php artisan vendor:publish --provider="Naif\LaravelPayPal\LaravelPayPalServiceProvider"

Configuration will be published at [config/laravel-paypal.php].

API KEYS

Get your API access from PayPal website

https://www.paypal.com/businessprofile/mytools/apiaccess/firstparty/signature

Paypal > Profile > Profile and settings > My selling tools > API access > NVP/SOAP API integration (Classic)

Package screenshot

Add these to your .env

LARAVEL_PAYPAL_USERNAME=
LARAVEL_PAYPAL_PASSWORD=
LARAVEL_PAYPAL_SIGNATURE=

Usage

use Naif\LaravelPayPal\LaravelPayPal;

$paypal = new LaravelPayPal();


//Get Current Balance

$balance = $paypal->getBalance();

Response:
[
  "balance" => array:5 [?
      "ACK" => "Success"
      "L_AMT0" => "120.62"
      "L_SEVERITYCODE0" => null
      "L_ERRORCODE0" => null
      "L_LONGMESSAGE0" => null
    ]
]

//Get Transactions

$transactions = $paypal->getTransactions();
You can specify the number of days and number of transactions to retreive. Default (7 days, 10 transations)

Response:
[
 "transactions" => array:3 [?
     0 => array:11 [?
       "timestamp" => "2019-01-17"
       "timezone" => "GMT"
       "type" => "Payment"
       "email" => "naif@naif.io"
       "name" => "Naif Alshaye"
       "transaction_id" => "3DR402287R3992703"
       "status" => "Completed"
       "amt" => "1.00"
       "currency_code" => "USD"
       "fee_amount" => "-0.34"
       "net_amount" => "0.66"
     ]
 ]
]

Support:

naif@naif.io

https://www.linkedin.com/in/naif

License

The MIT License (MIT). Please see License File for more information.


  Files folder image Files (8)  
File Role Description
Files folder imagesrc (3 files, 2 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (8)  /  src  
File Role Description
Files folder imageconfig (1 file)
Files folder imageFacades (1 file)
  Plain text file LaravelPayPal.php Class Class source
  Plain text file LaravelPayPalConnector.php Class Class source
  Plain text file LaravelPayPalServiceProvider.php Class Class source

  Files folder image Files (8)  /  src  /  config  
File Role Description
  Accessible without login Plain text file laravel-paypal.php Aux. Auxiliary script

  Files folder image Files (8)  /  src  /  Facades  
File Role Description
  Plain text file LaravelPayPal.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:60
This week:0
All time:10,494
This week:455Up