PHPackages                             8ctopus/paypal-rest-api - 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. 8ctopus/paypal-rest-api

ActiveLibrary[Payment Processing](/categories/payments)

8ctopus/paypal-rest-api
=======================

Process payments and subscriptions with the PayPal REST API

4.1.2(5mo ago)045MITPHPPHP &gt;=8.1CI passing

Since Nov 20Pushed 5mo ago1 watchersCompare

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

READMEChangelogDependencies (8)Versions (26)Used By (0)

PayPal REST API
===============

[](#paypal-rest-api)

[![packagist](https://camo.githubusercontent.com/977533efb3e927669f99e2e3f4f1a325a8fb1cbfc44148d93497ff41a9d92282/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f70617970616c2d726573742d6170692f76)](https://packagist.org/packages/8ctopus/paypal-rest-api)[![downloads](https://camo.githubusercontent.com/1c0a95d714fbafab82e07ef111c8813e2895bbe5487ae429baa5b30af5c39a10/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f70617970616c2d726573742d6170692f646f776e6c6f616473)](https://packagist.org/packages/8ctopus/paypal-rest-api)[![min php version](https://camo.githubusercontent.com/4156b453b3f582d25cf0404aac7b90202780ac28f597653a2ad017512e9f2b2a/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f70617970616c2d726573742d6170692f726571756972652f706870)](https://packagist.org/packages/8ctopus/paypal-rest-api)[![license](https://camo.githubusercontent.com/b9b148b7f995597749cf8c7f7090c23f7fa1349494acf42721b9ca431e869d7a/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f70617970616c2d726573742d6170692f6c6963656e7365)](https://packagist.org/packages/8ctopus/paypal-rest-api)[![tests](https://github.com/8ctopus/paypal-rest-api/actions/workflows/tests.yml/badge.svg)](https://github.com/8ctopus/paypal-rest-api/actions/workflows/tests.yml)[![code coverage badge](https://raw.githubusercontent.com/8ctopus/paypal-rest-api/image-data/coverage.svg)](https://raw.githubusercontent.com/8ctopus/paypal-rest-api/image-data/coverage.svg)[![lines of code](https://raw.githubusercontent.com/8ctopus/paypal-rest-api/image-data/lines.svg)](https://raw.githubusercontent.com/8ctopus/paypal-rest-api/image-data/lines.svg)

A php implementation of the PayPal REST API using `PSR-7`, `PSR-17` and `PSR-18`.

The package is a work in progress and contributions are welcome. For now, it covers `Orders` (one-time payments), subscriptions (`Products`, `Plans` and `Subscriptions`), `Webhooks` (receive notifications from PayPal when certain events occur) and `Payments`. That's all that's needed to create a store, be it one-time payment or subscription based.

*NOTE*: If you're just starting to use PayPal think twice, as I have found that their apis are unstable, bugs are introduced all the time in production and despite contacting Merchant Technical Support the issues take forever to get fixed. Save yourself the hassle and use a more reliable payment provider.

install package
---------------

[](#install-package)

```
composer require 8ctopus/paypal-rest-api

```

before you get started
----------------------

[](#before-you-get-started)

Copy `.env.example` to `.env` and fill in your PayPal REST API credentials. If you don't have credentials yet, follow the guide:

```
https://developer.paypal.com/api/rest/

```

demo
----

[](#demo)

Here's a code sample that shows how to make a one-time payment. To see all possibilites run `php demo.php`. There is also a demo store using this package, check out [PayPal sandbox](https://github.com/8ctopus/paypal-sandbox).

```
use HttpSoft\Message\RequestFactory;
use HttpSoft\Message\StreamFactory;
use Nimbly\Shuttle\Shuttle;
use Oct8pus\PayPal\Orders;
use Oct8pus\PayPal\Orders\Intent;
use Oct8pus\PayPal\OAuth;
use Oct8pus\PayPal\HttpHandler;

require_once __DIR__ . '/vendor/autoload.php';

$handler = new HttpHandler(
    // PSR-18 http client
    new Shuttle(),
    // PSR-17 request factory
    new RequestFactory(),
    // PSR-7 stream factory
    new StreamFactory()
);

$sandbox = true;

// get authorization token
$auth = new OAuth($sandbox, $handler, 'rest.id', 'rest.secret');

$orders = new Orders($sandbox, $handler, $auth);

// create order
$response = $orders->create(Intent::Capture, 'USD', 10.0);

// you must redirect the user to approve the payment before you can capture
$redirectUrl = "https://www.sandbox.paypal.com/checkoutnow?token={$response['id']}";

...

// once the user has approved the payment, capture it
$response = $orders->capture($args['id']);

if ($response['status'] === 'COMPLETED') {
    echo 'payment processed!';
}
```

run tests
---------

[](#run-tests)

```
composer test

```

references
==========

[](#references)

- PayPal REST API official documentation:
- PayPal REST archived php SDK

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance71

Regular maintenance activity

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~30 days

Recently: every ~59 days

Total

25

Last Release

164d ago

Major Versions

0.4.2 → 1.0.02024-05-16

1.1.1 → 2.0.02024-05-21

2.3.0 → 3.0.02024-11-18

3.2.0 → 4.0.02025-04-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/4dafd5f7ef8134a5c9b231686c5da3d6416db09139b45aac0b26952178dffb8a?d=identicon)[8ctopus](/maintainers/8ctopus)

---

Top Contributors

[![8ctopus](https://avatars.githubusercontent.com/u/13252042?v=4)](https://github.com/8ctopus "8ctopus (203 commits)")

---

Tags

paypalpaypal-checkoutpaypal-rest-apipaypal-subscriptionsphppaymentspaypalsubscriptions

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/8ctopus-paypal-rest-api/health.svg)

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

###  Alternatives

[aktive_merchant/aktive_merchant

Aktive-Merchant provides a common interface to process payments using multiple gateways.

15036.8k](/packages/aktive-merchant-aktive-merchant)[enupal/stripe

Allows customers sign up for recurring and one-time payments with Stripe, perfect for orders, donations, subscriptions, and events. Create simple payment forms in seconds easily without coding. For Craft CMS 3.x

3416.5k1](/packages/enupal-stripe)[tomatophp/filament-payments

Manage your payments inside FilamentPHP app with multi payment gateway integration

542.3k](/packages/tomatophp-filament-payments)[mmanos/laravel-billing

A billing package for Laravel 4.

451.3k](/packages/mmanos-laravel-billing)

PHPackages © 2026

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