PHPackages                             sudiptpa/paypal-rest - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. sudiptpa/paypal-rest

ActiveLibrary[Payment Processing](/categories/payments)

sudiptpa/paypal-rest
====================

PayPal REST API gateway for Omnipay payment processing library.

v3.1(2y ago)1277↑215.8%1[1 PRs](https://github.com/sudiptpa/paypal-rest/pulls)MITPHPPHP ^7.2|^8

Since Sep 16Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sudiptpa/paypal-rest)[ Packagist](https://packagist.org/packages/sudiptpa/paypal-rest)[ Docs](https://github.com/sudiptpa/paypal-rest)[ RSS](/packages/sudiptpa-paypal-rest/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (6)Used By (0)

Omnipay: PayPal REST API
========================

[](#omnipay-paypal-rest-api)

**PayPal REST API driver for the Omnipay PHP payment processing library**

[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP. This package implements PayPal REST API support for Omnipay.

[![Latest Stable Version](https://camo.githubusercontent.com/185bd632f0025a3d7b5e777ea4b869122ae6a3294f1739476b3235ffd52ecd66/687474703a2f2f706f7365722e707567782e6f72672f73756469707470612f70617970616c2d726573742f76)](https://packagist.org/packages/sudiptpa/paypal-rest) [![Total Downloads](https://camo.githubusercontent.com/d9f4b50170c2b1d9269a010b447689088cf19ae05661756bcd7e4759ffeb27ac/687474703a2f2f706f7365722e707567782e6f72672f73756469707470612f70617970616c2d726573742f646f776e6c6f616473)](https://packagist.org/packages/sudiptpa/paypal-rest) [![Latest Unstable Version](https://camo.githubusercontent.com/8cf45c9de70f8ba5a0a43ed0e55083236dd05e464f69732323421c27371fdcea/687474703a2f2f706f7365722e707567782e6f72672f73756469707470612f70617970616c2d726573742f762f756e737461626c65)](https://packagist.org/packages/sudiptpa/paypal-rest) [![License](https://camo.githubusercontent.com/da08b7589237e1172c288aafa26f24301bce4c0dbfb161c4032cda0023c6fd07/687474703a2f2f706f7365722e707567782e6f72672f73756469707470612f70617970616c2d726573742f6c6963656e7365)](https://packagist.org/packages/sudiptpa/paypal-rest) [![PHP Version Require](https://camo.githubusercontent.com/b2363e94c4070cdcb099eb81dadef139c7ca49c6a3ea4904b607e61df81d3104/687474703a2f2f706f7365722e707567782e6f72672f73756469707470612f70617970616c2d726573742f726571756972652f706870)](https://packagist.org/packages/sudiptpa/paypal-rest)

Installation
------------

[](#installation)

Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it to your `composer.json` file:

```
{
    "require": {
        "sudiptpa/paypal-rest": "~3.0"
    }
}
```

And run composer to update your dependencies:

```
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update

```

Usage
-----

[](#usage)

The library follows PayPal REST Orders v2 API, and below are the supported features.

#### Orders API v2

[](#orders-api-v2)

- [Create Order](https://developer.paypal.com/docs/api/orders/v2/#orders_create)
- [Show Order Details](https://developer.paypal.com/docs/api/orders/v2/#orders_get)
- [Capture Payment for Order](https://developer.paypal.com/docs/api/orders/v2/#orders_capture)
- [Add Tracking for an Order](https://developer.paypal.com/docs/api/orders/v2/#orders_track_create)
- [Verify Webhook Signature](https://developer.paypal.com/docs/api/webhooks/v1/#verify-webhook-signature_post)
- [List Webhooks](https://developer.paypal.com/docs/api/webhooks/v1/#webhooks_list)
- [Delete Webhook](https://developer.paypal.com/docs/api/webhooks/v1/#webhooks_delete)

If you want the features other than mentioned above, then feel free to submit a PR by following the coding standard.

#### Initiate Gateway Request

[](#initiate-gateway-request)

```
use Omnipay\Omnipay;

$gateway = Omnipay::create('PayPalRest_Rest');

$gateway->setClientId('xxxxxxxxxxx');
$gateway->setSecret('xxxxxxxxxxx');
$gateway->setTestMode('xxxxxxxxxxx');
```

#### Access Token

[](#access-token)

```
$accessToken = $gateway->getToken();
 or
$accessToken = $gateway->createToken()->send();
```

Note, the Access Token is not stored in the gateway at this point.

Management of the Access Token is not (yet) included in this library. You should implement your own method for saving and reusing the Access Token until expired to avoid hitting PayPal query limits by generating a token for each API call.

You can set a previously retrieved Access Token in the gateway as follows:

```
$gateway->setToken($accessToken);
```

#### API Calls

[](#api-calls)

```
$payload = [
    'amount' => 20,
    'transactionId' => '1001',
    'transactionReference' => 'INV-1001',
    'currency' => 'USD',
    'items' => [
        [
            'name' => 'Test Product 1',
            'description' => 'A sample description',
            'quantity' => 1,
            'price' => 20,
            'sku' => 'ITEM-CODE1',
            'category' => 'PHYSICAL_GOODS',
            'reference' => 'ITEM',
        ]
    ],
    'cancelUrl' => 'https://example.com/cancel/url',
    'returnUrl' => 'https://example.com/return/url',
];

$response = $gateway->purchase($payload)->send();

if ($response && $response->isSuccessful()) {
    // handle the success

    if ($response->isRedirect()) {
        $response->redirect();
    }

    // do something else
}

// handle the failure
```

#### Capture

[](#capture)

```
$response = $gateway->completePurchase([
    'transactionReference' => 'PAYPAL-ORDER-ID',
])->send();

if ($response && $response->isSuccessful() && $response->isCaptured()) {
    // handle success
}

// handle failure
```

#### Fetch PayPal Order

[](#fetch-paypal-order)

```
$response = $gateway->fetchPurchase([
    'transactionReference' => 'PAYPAL-ORDER-ID',
])->send();

if ($response && $response->isSuccessful()) {
    // handle success
}

// handle failure
```

For general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay)repository.

Support
-------

[](#support)

If you are having general issues with Omnipay, we suggest posting on [Stack Overflow](http://stackoverflow.com/). Be sure to add the [omnipay tag](http://stackoverflow.com/questions/tagged/omnipay) 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](https://groups.google.com/forum/#!forum/omnipay) which you can subscribe to.

If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/sudiptpa/paypal-rest/issues), or better yet, fork the library and submit a pull request.

License
-------

[](#license)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

5

Last Release

933d ago

Major Versions

2.0.x-dev → 3.02023-09-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/89a8c4cc02c4a958a03c60826c3d24b9dcbade10d3439e60e266702dbacc61e4?d=identicon)[sudiptpa](/maintainers/sudiptpa)

---

Top Contributors

[![sudiptpa](https://avatars.githubusercontent.com/u/7222620?v=4)](https://github.com/sudiptpa "sudiptpa (24 commits)")

---

Tags

hacktoberfesthacktoberfest-acceptedpayment-gatewaypayment-integrationpaypalpaypal-apipaypal-buttonpaypal-checkoutpaypal-express-checkoutpaypal-ipnpaypal-payment-gatewaypaypal-php-sdkpaypal-rest-apipaypal-rest-sdkphprest-apipaymentgatewaypaypalpaymerchantomnipaypurchase

### Embed Badge

![Health badge](/badges/sudiptpa-paypal-rest/health.svg)

```
[![Health](https://phpackages.com/badges/sudiptpa-paypal-rest/health.svg)](https://phpackages.com/packages/sudiptpa-paypal-rest)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[lokielse/omnipay-alipay

Alipay gateway for Omnipay payment processing library

587421.0k11](/packages/lokielse-omnipay-alipay)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
