PayPal driver for the Omnipay PHP payment processing library

Overview

Omnipay: PayPal

PayPal driver for the Omnipay PHP payment processing library

Build Status Latest Stable Version Total Downloads

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP. This package implements PayPal support for Omnipay.

Installation

Omnipay is installed via Composer. To install, simply require league/omnipay and omnipay/paypal with Composer:

composer require league/omnipay omnipay/paypal

Basic Usage

The following gateways are provided by this package:

  • PayPal_Express (PayPal Express Checkout)
  • PayPal_ExpressInContext (PayPal Express In-Context Checkout)
  • PayPal_Pro (PayPal Website Payments Pro)
  • PayPal_Rest (Paypal Rest API)

For general usage instructions, please see the main Omnipay repository.

Quirks

The transaction reference obtained from the purchase() response can't be used to refund a purchase. The transaction reference from the completePurchase() response is the one that should be used.

Out Of Scope

Omnipay does not cover recurring payments or billing agreements, and so those features are not included in this package. Extensions to this gateway are always welcome.

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.

Comments
  • ExpressCompletePurchaseResponse getTransactionReference() error

    ExpressCompletePurchaseResponse getTransactionReference() error

    After completing the Express Checkout purchase, doing $response->getTransactionReference() on the response returns the token instead of the transaction id.

    opened by dmaksimov 23
  • Receiving CurlException in CurlMulti.php line 359: [curl] 28: Operation timed out

    Receiving CurlException in CurlMulti.php line 359: [curl] 28: Operation timed out

    I have a laravel app with paypal, it was working fine until now, i am receiving this message, i didn't touch the code.

    CurlException in CurlMulti.php line 359: [curl] 28: Operation timed out after 0 milliseconds with 0 out of 0 bytes received [url] https://api-3t.paypal.com/nvp?VERSION=119.0

    opened by rdgutierrez 21
  • Implement GetExpressCheckoutDetails and MassPay operations

    Implement GetExpressCheckoutDetails and MassPay operations

    In our business we need to do extra risk and security checks, and thus I had the necessity to implement this express operation.

    I have created unit tests for it, and also made the AbstractRequest a little bit better, imo.

    There are no BC breaks, so you can just up the middle version number if you want. (;

    opened by alfaproject 15
  • Support for paypal error 10486

    Support for paypal error 10486

    Error 10486 allows for a redirect back to paypal during a completePayment call.

    This pull requests adds a modified CompletePaymentRequest which returns a CompletePaymentResponse which could be successful as usual OR a redirect response if error 10486 is detected.

    Documentation: https://developer.paypal.com/docs/classic/express-checkout/ht_ec_fundingfailure10486/

    Would love some feedback on this. This attempts to fix #143

    opened by lukeholder 13
  • getTransactionId() undefined method

    getTransactionId() undefined method

    Hi, i'm testing PayPal Express. In doc (https://github.com/thephpleague/omnipay readme) about "Successful Response" i read:

    "... The following methods are always available: ... $response->getTransactionId(); // the reference set by the originating website if available. ...."

    but if i try to use getTransactionId() method, i get the following:

    Fatal error: Call to undefined method Omnipay\PayPal\Message\ExpressAuthorizeResponse::getTransactionId()

    For PayPal Express this method not exists.

    Thanks, Achille

    opened by adaniello 13
  • API version update for Express Checkout

    API version update for Express Checkout

    So, after talking to PayPal today, the latest API version for the Express Checkout is 119.0. Since the current library is listed as 85.0 with no mechanism for overriding it, I'd like to know what the best foot forward is - is it better to have a look at the list of changelogs and update the functionality while leaving keyed to a specific API version, or provide a means to set the API version you'd like to call and use the constant as a back up if none is supplied?

    opened by leith 12
  • TLS 1.2 support

    TLS 1.2 support

    According to https://devblog.paypal.com/upcoming-security-changes-notice/ Paypal is turning off SSL support in June 17, but I'm receiving errors from apps on sandbox right now as well.

    Should we expect the library to change to TLS 1.2 by default? Is there anything I can do to help you with that?

    Cheers!

    opened by guiwoda 9
  • Please add means for me to get the buyers email after transaction complete.

    Please add means for me to get the buyers email after transaction complete.

    After completing my payments with gateway->completePurchase($params)->send(), There is no way to get the buyers email for the paypal transaction?

    enhancement 
    opened by AchoArnold 9
  • Added logo image and border color customisations

    Added logo image and border color customisations

    PayPal offers the ability to specify a logo image and the border gradient color (as well as a header image). This pull request adds the ability to set both of these.

    opened by martinbean 8
  • Paypal Express checkout - Invalid token

    Paypal Express checkout - Invalid token

    I'm doing my own e-commerce website by using CI with omnipay. I'm facing one problem after paypal express checkout is finished like "Invalid token" - error code:10410. Below is my code.

    require 'vendor/autoload.php'; use Omnipay\Omnipay;

    $gateway = Omnipay::create('PayPal_Express'); $gateway->setUsername("MY-PAYPAL-PRO-USERNAME"); $gateway->setPassword("MY-PAYPAL-PRO-PASSWORD"); $gateway->setSignature("MY-PAYPAL-PRO-SIGNATURE"); $gateway->setTestMode(true); // right now i'm using testing environment

    $order_id = $this->insert_order(); // i wrote separate method to insert the order items and it will return the order id.

     $params = array(
            'amount' => '500',
            'currency' => 'USD',
            'returnUrl' => base_url("checkout/returnBack/$order_id"),
            'cancelUrl' => base_url("checkout/returnBack/$order_id"));
    
        $response = $gateway->completePurchase($params)->send();
    
        $data = $response->getData(); // this is the raw response object
        echo '<pre>';
        print_r($data);
        echo '</pre>';die;
    

    Following is the error:

    Array ( [TIMESTAMP] => 2014-03-04T10:41:49Z [CORRELATIONID] => 570332778c46c [ACK] => Failure [VERSION] => 85.0 [BUILD] => 9917844 [L_ERRORCODE0] => 10410 [L_SHORTMESSAGE0] => Invalid token [L_LONGMESSAGE0] => Invalid token. [L_SEVERITYCODE0] => Error )

    Please help me out for this issue. I'm trying last two days, i'm not getting anything from google. Thanks in advance.

    opened by smanikandan-btech 8
  • PayPalExpress handling refunds?

    PayPalExpress handling refunds?

    Hey Guys,

    Struggling on this one. I've got the API working quite easily out of the box. But I am struggling to fathom out how we handle Refunds/Pending transactions with PayPal Express.

    There doesn't seem to be a way to set the NotifyURL or invoice within $gateway->purchase();

    Does anyone have any example code of how they have achieved managing refunds, partial refunds, pending transactions etc?

    Many thanks Tony

    opened by tonypartridge 7
  • Custom parameter

    Custom parameter

    Hi, try to add an extra parameter but it doesn't work. I tried the following ways:

         `$purchase = $this->gateway->purchase(array(
                'amount' => $request->amount,
                'currency' => $this->client->currency,
                'returnUrl' => url('success'),
                'cancelUrl' => url('error')
            ));
            $purchase->setParameter('custom', 'custom');
            $response = $purchase->send();`
    

    Error- Call to protected method Omnipay\Common\Message\AbstractRequest::setParameter() from scope App\Http\Controllers\PaymentController

    §

    $purchase = $this->gateway->purchase(array( 'amount' => $request->amount, 'currency' => $this->client->currency, 'returnUrl' => url('success'), 'cancelUrl' => url('error') )); $data = $purchase->getData(); $data['RANDOM_DATA'] = 'hello'; $purchase->sendData($data);

    opened by Wikko0 0
  • notifyUrl doesn't work!

    notifyUrl doesn't work!

    Dear omnipay-paypal community,

    Recently PayPal contacted me to upgrade my 'old-style' CodeIgniter e-commerce cart (an old standard paypal gateway with a simple form to related paypal endpoint) to a solution with access token and client_id + secret. I used omnipay-paypal, following a guide like this:

    https://artisansweb.net/paypal-payment-gateway-integration-in-php-using-paypal-rest-api/

    And everything seems working fine, but with old standard cart I used a notifyUrl to send payment post data to a controller that made something like this:

    foreach ($_POST as $key => $value) {
    $request .= '&' . $key . '=' . urlencode(html_entity_decode($value, ENT_QUOTES, 'UTF-8'));
    }
    
    $curl = curl_init('https://www.paypal.com/cgi-bin/webscr');
    
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_TIMEOUT, 120);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    
    $response = curl_exec($curl);
    

    If that $response is VERIFIED, I enable related order for delivery (paid). Issue is that notifyUrl isn't triggered at all with Omnipay and this avoids to fit the shoe.

    I tried to setup notifyUrl parameter on purchase, completePurchase method, but nothing to do: no call is sent after payment confirmation and no payment data in the related $_POST object.

    Someone could give me some hint or help?

    opened by MarcoHijacker 0
  • Missing Authorization header

    Missing Authorization header

    Im getting Authentication failed due to invalid authentication credentials or a missing Authorization header. when using this package with laravel and vue

    opened by Nolife159159 0
  • Error request nothing works php 8.0

    Error request nothing works php 8.0

    Hi,

    May someone help ? I'm using php 8.0 on docker alpine version. Composer includes:

    "league/omnipay": "^3.2", "omnipay/paypal": "^3.0"

    When i run my code i see this typeerror message: Symfony\Component\HttpFoundation\Request::createRequestFromFactory(): Argument #2 ($request) must be of type array, null given, called in /var/www/html/vendor/symfony/http-foundation/Request.php on line 306

    Heres how i run code: $gateway = Omnipay::create('PayPal_Rest');
    $gateway->setClientId( $this->config['paypal_client_id'] ); $gateway->setSecret( $this->config['paypal_secret'] ); $gateway->setTestMode( (!empty( $this->config['paypal_testmode']) ? true : false) );

    Errors show on Omnipay::create

    the same code works ok on server with php 7.2 so i was wondering if i made some mistake here - and i need to include httpclient or something. Please help me.

    opened by avatec 1
  • Passing taxes in Paypal Pro/Rest

    Passing taxes in Paypal Pro/Rest

    Hi, is possible to pass the sales tax via paypal pro and paypal rest to the paypal backend? I have tried taxAmount and setTaxAmount but it doesn't make a diffidence in populating the sales tax field in paypal. Any help with this will be greatly appreciated. Thanks

    opened by kerongon 1
  • cannot call shipping parameter

    cannot call shipping parameter

    hello, i trying calling shipping parameter but looks like its not working, on paypal payment its not showing shipping. can i know whats wrong with my code?

     $response = $gateway->purchase(array(
            'shippingAmount' => SHIPPING,
            'amount' => $totalprice,
        
        'items' => $items,
    
    opened by mediaposter 0
Releases(v2.6.4)
Owner
The League of Extraordinary Packages
A group of developers who have banded together to build solid, well tested PHP packages using modern coding standards.
The League of Extraordinary Packages
Implementation of a library to process SISP vinti4 payment in a easy way.

Implementation of a library to process SISP vinti4 payment in a easy way.

Faxi 6 Nov 3, 2022
A Laravel SQS driver that removes the 256KB payload limit by saving the payloads into S3.

Simple SQS Extended Client Introduction Simple SQS Extended Client is a Laravel queue driver that was designed to work around the AWS SQS 256KB payloa

Simple Software LLC 7 Dec 8, 2022
2c2p payment gateway Redirect PHP-SDK

2c2p payment gateway Redirect PHP-SDK

Bilions 2 Oct 1, 2022
WHMCS USDT Payment Gateway.

WHMCS USDT Payment Gateway 支持 TRC-20 USDT 转账交易,系统可完成自动化分配地址,入账等操作,配置简单,无需第三方支付平台中转,所有交易直达您的私人账户。 Requirements PHP 7.2 or greater. WHMCS 8.1 or greater

Licson 59 Jan 7, 2023
API client for ThePay - payment gate API

This is the official highly compatible public package of The Pay SDK which interacts with The Pay's REST API. To get started see examples below.

ThePay.cz s.r.o. 3 Oct 27, 2022
Simple papara payment api that you can use without the need for an activation key

PaparaQrApi Papara QR Api Simple papara payment api that you can use without the need for an activation key. Explore the docs » View Demo About The Pr

Azad 6 Dec 20, 2022
BeckhoffPLCSoapClient - SoapClient to communicate with BeckHoff PLC. Library made in PHP based on TcAdsWebService JavaScript Library.

BeckhoffPLCSoapClient - SoapClient to communicate with BeckHoff PLC. Library made in PHP based on TcAdsWebService JavaScript Library.

null 3 May 18, 2022
Lightweight PHP library for WhatsApp API to send the whatsapp messages in PHP provided by ultramsg.com

Ultramsg.com WhatsApp API PHP SDK Lightweight PHP library for WhatsApp API to send the whatsappp messages in PHP provided by Ultramsg.com Installation

Ultramsg 117 Dec 26, 2022
Google-api-php-client - A PHP client library for accessing Google APIs

Google APIs Client Library for PHP Reference Docs https://googleapis.github.io/google-api-php-client/main/ License Apache 2.0 The Google API Client Li

Google APIs 8.4k Dec 30, 2022
Wise-php - This library is written to accommodate the wise API's use in php projects With Wise

Wise-php - This library is written to accommodate the wise API's use in php projects With Wise you can automate payments, connect your business tools, and create ways to manage your finances. You can also power your cross-border and domestic payouts.

Albert Xhani 15 Nov 17, 2022
A framework agnostic PHP library to build chat bots

BotMan If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming PHP Package Development video course. About BotMa

BotMan 5.8k Jan 3, 2023
PHP library for the Stripe API.

Stripe PHP bindings The Stripe PHP library provides convenient access to the Stripe API from applications written in the PHP language. It includes a p

Stripe 3.3k Jan 5, 2023
A PHP library for communicating with the Twilio REST API and generating TwiML.

twilio-php The default branch name for this repository has been changed to main as of 07/27/2020. Documentation The documentation for the Twilio API c

Twilio 1.4k Jan 2, 2023
A PHP library for the Campaign Monitor API

createsend A PHP library which implements the complete functionality of the Campaign Monitor API. Installation Composer If you use Composer, you can r

Campaign Monitor 287 Jan 6, 2023
PHP 5.3+ library which helps you to interact with the DigitalOcean API

DigitalOcean The version 2 of the API will be available soon ! Please visit DigitalOceanV2 and contribute :) This PHP 5.3+ library helps you to intera

Antoine Kirk 156 Jul 30, 2022
A versatile PHP Library for Google PageSpeed Insights

PhpInsights An easy-to-use API Wrapper for Googles PageSpeed Insights. The JSON response is mapped to objects for an headache-free usage. Installation

Daniel Sentker 110 Dec 28, 2022
PHP library for the GitHub API v3

GitHub API v3 - PHP Library Currently under construction. Overview Provides access to GitHub API v3 via an Object Oriented PHP library. The goal of th

Darren Rees 62 Jul 28, 2022
PHP library to use IOTA REST API to help node management and tangle queries

iota.php About PHP library to use IOTA REST API to help node management and tangle queries. Please be aware that this library is in an early developme

IOTA Community 45 Dec 13, 2022
A Class Library enabling Asterisk ARI functionality for PHP

phpari A Class Library enabling Asterisk ARI functionality for PHP Dependencies These are the minimum requirements to have phpari installed on your se

Nir Simionovich 87 Jan 5, 2023