Laravel plugin for processing payments through PayPal. Can be used separately.

Overview

Laravel PayPal

Software License Latest Version on Packagist Total Downloads StyleCI Tests Coverage Status Code Quality

Documentation

The documentation for the package can be viewed by clicking the following link:

https://srmklive.github.io/laravel-paypal/docs.html

Usage

Following are some ways through which you can access the paypal provider:

// Import the class namespaces first, before using it directly
use Srmklive\PayPal\Services\PayPal as PayPalClient;

$provider = new PayPalClient;

// Through facade. No need to import namespaces
$provider = PayPal::setProvider();

Override PayPal API Configuration

You can override PayPal API configuration by calling setApiCredentials method:

$provider->setApiCredentials($config);

Get Access Token

After setting the PayPal API configuration by calling setApiCredentials method. You need to get access token before performing any API calls

$provider->getAccessToken();

Set Currency

By default the currency used is USD. If you wish to change it, you may call setCurrency method to set a different currency before calling any respective API methods:

$provider->setCurrency('EUR');

Initiating an order for Checkout

Use the createOrder method to initiate an order

"CAPTURE", "purchase_units"=> [ 0 => [ "amount"=> [ "currency_code"=> "USD", "value"=> "100.00" ] ] ] ]); ">
$provider->createOrder([
  "intent"=> "CAPTURE",
  "purchase_units"=> [
      0 => [
          "amount"=> [
              "currency_code"=> "USD",
              "value"=> "100.00"
          ]
      ]
  ]
]);

The response from this will include an order ID which you will need to retail, and a links collection so you can redirect the user to Paypal to complete the order with their payment details

When the user returns to the notifcation url you can capture the order payment with

$provider->capturePaymentOrder($order_id); //order id from the createOrder step 

Support

This version supports Laravel 6 or greater.

  • In case of any issues, kindly create one on the Issues section.
  • If you would like to contribute:
    • Fork this repository.
    • Implement your features.
    • Generate pull request.
Comments
  • getRecurringPaymentsProfileDetails - 'Unspecified Method' error

    getRecurringPaymentsProfileDetails - 'Unspecified Method' error

    After switching to 1.4.5 i get an 'Unspecified Method' error when I try to call
    getRecurringPaymentsProfileDetails($profileId)

    'ACK' => 'Failure',
    'L_ERRORCODE0' => '81002',
    'L_SHORTMESSAGE0' => 'Unspecified Method',
    'L_LONGMESSAGE0' => 'Method Specified is not Supported',
    'L_SEVERITYCODE0' => 'Error',
    

    Same code worked fine on the previous version.. 1.4.2 I think it was.

    update

    I'm now finding that all the calls towards paypal's API are failing with the same error..

    Is this just me or..?

    bug debug 
    opened by sasha13 19
  • Security header is not valid for live credentials

    Security header is not valid for live credentials

    Hi srmklive, I am using your package. For Express Checkout, when i am using sandbox API then everything OK and work fine. But live credential problem. In sandbox account , i get user name, password, and API secret and they provides us this information.but when i create live app in REST API apps section then they provide sandbox and live two different section . I select live where i get pay-pal account, client id, secret but password missing. In your application i used this pay-pal account as a user name, secret as a secret, and my login password as a password. After configure that i am trying to express checkout for my live application but they provide me error such as :

    [TIMESTAMP] => 2017-06-08T10:58:42Z [CORRELATIONID] => xxxxxxxxxx [ACK] => Failure [VERSION] => 123 [BUILD] => xxxxxx [L_ERRORCODE0] => 10002 [L_SHORTMESSAGE0] => Security error [L_LONGMESSAGE0] => Security header is not valid [L_SEVERITYCODE0] => Error

    Please help me to solve this. And give me guideline to recover this problem. am i doing any wrong then please suggest me.

    @srmklive I am using Laravel version 5.3 and "srmklive/paypal": "~1.0"

    opened by raihancse104 18
  • "No paypal_link in response"?

    Hi,

    I have recently come back to an old project where my PayPal functionality was working fine using this package. Unfortunately (even after updating) I seem to now be encountering an issue where setExpressCheckout() does not seem to be functioning correctly.

    I've inspected the ExpressCheckout provider, I've inspected the data containing an array of items etc being sent and all contains the correct information. I'm starting to wonder how the functionality has suddenly stopped working.

    All I am getting back is: Array ( [type] => error [message] => [paypal_link] => )

    This is similar to another closed but unresolved issue from about a month ago.

    Any ideas what is causing this? It's quite urgent.

    Thanks

    opened by karam94 17
  • can not create plan without trial pricing

    can not create plan without trial pricing

    I can not create subscription plan for a user if I pass without add addPlanTrialPricing() method, and if i send 0 days as trial days it also can not create plan. without addPlanTrialPricing() method its giving Request is not well-formed, syntactically incorrect, or violates schema error

    here is my sample code

    if($userPackage->regular_tier == 'D'){ 
               $plan = 'addDailyPlan';
            } elseif ($userPackage->regular_tier == 'M') {
                $plan = 'addMonthlyPlan';
            } elseif ($userPackage->regular_tier == 'W') {
                $plan = 'addWeeklyPlan';
            } else {
                $plan = 'addYearlyPlan';
            }
    $provider = PayPal::setProvider();
            $provider->getAccessToken();
    $response = $provider->addProduct( $userPackage->title . " teacher: #".auth()->id(), $userPackage->desc, 'SERVICE', 'SOFTWARE' )
           // ->addPlanTrialPricing( $trialTier, $userPackage->trial_period )
            ->$plan( $userPackage->title . " teacher: #".auth()->id(). " plan", $userPackage->desc, $userPackage->regular_amount )
            ->setupSubscription( auth()->user()->full_name, auth()->user()->email,now()->addMinute() );
            
    
    opened by fftfaisal 16
  • guest payment

    guest payment

    Excuse me, Could this package support guest payment in Paypal? Buyers Can Checkout Without a PayPal Account.

    We enable the PayPal Account Optional option in our account settings, but still can't do guest payment.

    Not sure if there is a setting missed or Paypal policy, though we are using Taiwan Business account.

    Any suggestions or hints are appreciated.

    Thanks a lot.

    opened by tedinpcshool 15
  • Adaptive 520003 Authentication failed

    Adaptive 520003 Authentication failed

    When trying to do chained payment I always get this error:

    "'1.0' encoding='UTF-8'?>2016-06-13T18:04:28.165-07:00Failure002d6b3b4261a20420247520003PLATFORMApplicationErrorApplicationAuthentication failed. API credentials are incorrect./ns3:FaultMessage

    ErrorId 520003 Message Authentication failed. API credentials are incorrect.

    I double check my sandbox credentials and are correct:

        'username' => 'jorge.alexandro-facilitator_api1.gmail.com',
        'password' => '1364842417',
        'secret' => 'A8.lGiHnS.gATAUMTDDqJEv32m7eAEygtB5hcwPxiugnKJ6bio.Hl6xY',
        //'certificate' => '',
        'app_id' => 'APP-80W284485P519543T',
    

    Same credentials works good in express checkout only adaptive is not working. Any idea or help?

    bug enhancement debug 
    opened by jorgealexandro 15
  • ExpressCheckout.php line 127: Undefined index: TOKEN

    ExpressCheckout.php line 127: Undefined index: TOKEN

    Hi,

    I am using below code. but it showing me the Undefined index:token.

    'Product 1', 'price' => 9.99, 'qty' => 1 ], [ 'name' => 'Product 2', 'price' => 4.99, 'qty' => 2 ] ]; $data['invoice_id'] = 1; $data['invoice_description'] = "Order #{$data['invoice_id']} Invoice"; $data['return_url'] = url('/payment/success'); $data['cancel_url'] = url('/cart'); $total = 0; foreach($data['items'] as $item) { $total += $item['price']*$item['qty']; } $data['total'] = $total; $options = [ 'BRANDNAME' => 'MyBrand', 'LOGOIMG' => 'https://example.com/mylogo.png', 'CHANNELTYPE' => 'Merchant' ]; $response = $provider->setExpressCheckout($data); // This will redirect user to PayPal return redirect($response['paypal_link']); dd($response); } }
    opened by rahulnegi 14
  • getting error

    getting error

    Hi Team,

    I appreciate for your great work on paypal plugin.

    But I need to know about few things, Please check

    untitled

    I have implement all the thing according to shared in your doc for adaptive payment, but I am getting above error. I am using laravel 5.1. Please check and let me know.

    Also I have set return and cancel URL, But I am not getting any response from paypal, so can you guide me how I can get the payment response from the paypal

    debug 
    opened by sharmasaurabh1 14
  • Not able to process payment on Live mode via credit / debit card.

    Not able to process payment on Live mode via credit / debit card.

    Currently I am using this library and I am able to make payment on sandbox environment. On live user is trying to make payment via credit or debit card user is redirected to PayPal website, but payment is not completed.

    Is this library supports for credit and debit card payment.?

    I am getting below value in paypal_link:

    "paypal_link" => "https://www.paypal.com/webscr?cmd=_express-checkout&token=EC-4RY600814B770294Y"

    Also I checked with the paypal technical assistance they are saying "The API request stopped at SetExpressCheckOut" and from there it is not proceeding.

    Kindly let me know is this correct for live or am I missing something.

    question debug 
    opened by alankarmore 13
  • what is Sandbox API certificate ID and where can i find it?

    what is Sandbox API certificate ID and where can i find it?

    I am integrating recurring payment with paypal with laravel. right now its no localhost. i have completed steps you have given. but i'm not able to find sandbox API certificate ID. how to get that? and where can i find that sandbox API certificate ID. also there is no error message when i execute my code see below. image image

    opened by techybirds 12
  • Better Example?

    Better Example?

    Hello,

    I'm currently trying to use your package. I haven't worked with PayPal express checkout before, and don't know what information they're looking for, or where to look for the information they're looking for.

    Thus, I think it would be a good idea to create a more completed example which either includes links to the place you mentioned, or provides a more complete example in the readme in order to get my first response.

    Take it or leave it :)

    opened by MisterBrownRSA 12
  • Call to undefined method

    Call to undefined method

    Getting Call to undefined method Srmklive\PayPal\PayPalFacadeAccessor::create() when doing like this

    public function PayWithPaypal(Request $request)
        {
            // Create a new payment
            $payment = PayPal::create([
                'amount' => $request->amount,
                'currency' => $request->currency,
                'description' => $request->description,
                'return_url' => $request->return_url,
                'cancel_url' => $request->cancel_url,
            ]);
    
            // Get the payment URL
            $paymentUrl = $payment->getApprovalLink();
    
            // Return the payment URL to the frontend
            return response()->json([
                'paymentUrl' => $paymentUrl,
            ]);
        }
    
    opened by Nolife159159 0
  • How can i add a donations Button to my page using this package

    How can i add a donations Button to my page using this package

    Hello Team, i commend you for the wonderful job you've done. Mine is a Question Do we have a way of creating a donations button using this package? something similar to Donations Button.

    I have looked through the documentation of the package and i can't find it.

    Kindly guide me on this

    opened by HermanCeaser 0
  • Is there an easy way to cancel a Paypal Subscription?

    Is there an easy way to cancel a Paypal Subscription?

    Hello, I am looking for a way to cancel a Paypal Subscription, so that no recurring payment occurs after the end data of the subscription. Are there any helpers that this Laravel package provides? I have not seen any. Thank you so much for this great package.

    opened by thebeautyofcoding 2
  • Platform Fees is not working when I used DIGITAL_GOODS

    Platform Fees is not working when I used DIGITAL_GOODS

    [
        "intent" => "CAPTURE",
        "purchase_units" => [
            [
                "reference_id" => "random-ref-id",
                "amount" => [
                    "currency_code" => "USD",
                    "value" => "10.00",
                    "breakdown" => [
                        "item_total" => [
                            "currency_code" => "USD",
                            "value" => "10.00",
                        ],
                    ]
                ],
                'items' => [
                    [
                        'name' => "CERTIFICATE",
                        'unit_amount' => [
                            "currency_code" => "USD",
                            "value" => "10.00"
                        ],
                        'quantity' => 1,
                        'description' => "Purchase a certificate",
                        'category' => 'DIGITAL_GOODS',
                    ]
                ],
                "description" => "Purchase quiz completion certificate:outside items",
                "payee" => [
                    "email_address" => "[email protected]"
                ],
                "payment_instruction" => [
                    "disbursement_mode" => "INSTANT",
                    "platform_fees" => [
                        [
                            "amount" => [
                                "currency_code" => "USD",
                                "value" => "2.00"
                            ],
                            "payee" => [
                                "email_address" => "[email protected]"
                            ],
                        ]
                    ]
                ]
            ]
        ]
    ]
    

    When category DIGITAL_GOODS included then platform_fees is not working. When I remove 'category' => 'DIGITAL_GOODS' line then platform_fees is working. But My merchants sell digital goods on my website like certificate in form of PDF, some extra point to start the quiz, etc... platform_fees is our commission on the transaction. but digital_goods not support to add platform_fees. Is there any other way to achieve this? Or If I did any mistake then correct me. Thank You.

    opened by dipeshchangawala 0
  • Pay another account

    Pay another account

    Hello,

    I am creating a platform where users can sell their products themselves (Laravel 9). I would like to use PayPal for the payment platform, I came across this library.

    I would like to know if it's possible to specify a personalized email address (the user's) for the payment of an order instead of mine?

    I saw this in the PayPal documentation: https://developer.paypal.com/docs/checkout/standard/customize/pay-another-account/

    But I didn't see anything similar in the documentation of this library.

    Thanks you for your help

    opened by EvannG1 0
Releases(3.0.16)
PHP 7+ Payment processing library. It offers everything you need to work with payments: Credit card & offsite purchasing, subscriptions, payouts etc. - provided by Forma-Pro

Supporting Payum Payum is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our

Payum 1.7k Jan 5, 2023
A PayPal IPN client for Laravel.

PayPal IPN for Laravel 4 This package allows for the painless creation of a PayPal IPN listener in the Laravel 4 framework. Installation PayPal IPN fo

Logical Grape 35 Jul 8, 2021
Enable Standard PayPal for WooCommerce

Enable Standard PayPal for WooCommerce Contributors: vikcheema Donate link: https://paypal.me/SukhwantCheema Tags: woocommerce, payment gateway, paypa

Vik Cheema 2 Sep 9, 2021
StrongShop 是一款免费开源的跨境电商商城网站。基于 PHP Laravel6 框架开发,遵循 BSD-3-Clause 开源协议,免费商用。支持多语言,多货币,多种国际配送方式。PayPal 支付,国际信用卡支付。PC Web 端和移动端自适应。

跨境电商独立站的理想选择之一 StrongShop 简介 StrongShop 是一款免费开源的跨境电商商城网站。 StrongShop 是基于 PHP Laravel 框架开发的一款 Web 商城系统。 开发缘起是公司的一套跨境商城系统,原先公司使用的系统是基于 Ecshop 二次开发的,后来因为

OpenStrong 38 Dec 9, 2022
Paypal module for Thelia ecommerce solution

PayPal I) Install notes II) Configure your PayPal account III) Module options payments I) Installation Composer WARNING : A console access is required

null 8 Nov 22, 2022
Payum offers everything you need to work with payments. From simplest use cases to very advanced ones.

Supporting Payum Payum is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our

Payum 122 Dec 19, 2022
A framework agnostic, multi-gateway payment processing library for PHP 5.6+

Omnipay An easy to use, consistent payment processing library for PHP Omnipay is a payment processing library for PHP. It has been designed based on i

The League of Extraordinary Packages 5.7k Jan 4, 2023
Adds a new report to the WooCommerce analytics section about used payment methods.

Payment Methods Report for WooCommerce This is an extension to WooCommerce Analytics that will display a new report on the usage of configured payment

Martin Rehberger 1 Jan 15, 2022
An eCommerce website is an online store where you can buy or sell products online. An eCommerce offers a professional online store builder that helps you launch your eCommerce business quickly and successfully.

An eCOMMERCE-SITE An eCommerce website is an online store where you can buy or sell products online. An eCommerce offers a professional online store b

UTTKARSH PARMAR 2 Aug 8, 2022
The Marketplace plugin for WordPress and WooCommerce

WC Vendors 2.0 is a major update. This has a brand new settings system that is not backwards compatible with the existing one. This means all extensions and plugins that interact with WC Vendors will need to be updated to support this new system.

WC Vendors 147 Dec 16, 2022
Size chart plugin for Sylius ecommerce platform.

Madcoders Sylius Size Chart Plugin Features upload size chart files (for example for shoes, t-shirts and similar products) match size charts by rules

MADCODERS 4 Oct 29, 2021
QPay Moodle payment gateway plugin

QPay Moodle payment gateway plugin The plugin allows a site to connect to QPay. This plugin was developed by Smotana thanks to funding from Aspire Edu

Matus Faro 2 Dec 31, 2021
Plugin for Woocommerce that enables Visanet's Cybersource payment gateway as a payment method in your website checkout

Plugin for Woocommerce that enables Visanet's Cybersource payment gateway as a payment method in your website checkout

tipi(code) 2 Mar 8, 2022
Chargily ePay Gateway (WooCommerce Plugin)

Chargily ePay Gateway Donate link: https://epay.chargily.com/ chargily, payment, paiement, epay, cib, cibweb, edahabia, algerie, poste, satim, gie, mo

Chargily 15 Dec 7, 2022
Commerce GrappQL Package for Laravel

Sailwork Commerce Package for Laravel Document Please read document in here: Document Installation You can install the package via composer: composer

Sail Work 6 May 10, 2021
A robust session-based shopping bag for Laravel

Shopping Bag A robust session-based shopping bag for Laravel Go to documentation Documentation Documentation for Shopping Bag can be found in the docs

Laraware 30 Dec 13, 2021
Laravel FREE E-Commerce Software

Laravel FREE E-Commerce Software

Jeff Simons Decena 1.7k Dec 24, 2022
Antvel is an ecommerce project written in Laravel 5.* intended for building a friendly eStore either for startups or big companies.

Antvel is an ecommerce project written in Laravel 5.* intended for building a friendly eStore either for startups or big companies.

Antvel - Official 650 Dec 28, 2022
A free open source e-commerce platform for online merchants based on customised version of Laravel.

A free open source e-commerce platform for online merchants based on customised version of Laravel.

Ace Vinayak 58 Oct 19, 2022