PHPackages                             rapttor/whop-sdk-php - 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. rapttor/whop-sdk-php

ActiveLibrary[Payment Processing](/categories/payments)

rapttor/whop-sdk-php
====================

PHP SDK for the Whop API — payments, memberships, webhooks and more.

11PHP

Since Feb 25Pushed 2mo agoCompare

[ Source](https://github.com/rapttor/whop-sdk-php)[ Packagist](https://packagist.org/packages/rapttor/whop-sdk-php)[ RSS](/packages/rapttor-whop-sdk-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

rapttor/whop-sdk-php
====================

[](#rapttorwhop-sdk-php)

[![CI](https://github.com/rapttor/whop-sdk-php/actions/workflows/ci.yml/badge.svg)](https://github.com/rapttor/whop-sdk-php/actions)[![Latest Version](https://camo.githubusercontent.com/29e1c6cdcf74214ba4535d18a0f3c520de538a2fc620906d9bb981ca7ee9ffb4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72617074746f722f77686f702d73646b2d7068702e737667)](https://packagist.org/packages/rapttor/whop-sdk-php)[![PHP Version](https://camo.githubusercontent.com/bff57d3653844b0f0a013f0f68b177a16ad95e96437c52c90818ca6176c083d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f72617074746f722f77686f702d73646b2d7068702e737667)](https://packagist.org/packages/rapttor/whop-sdk-php)[![License](https://camo.githubusercontent.com/b5536e7de325d5bc055681be3b25a1529a634726c32d02332f493bb9c4c550fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f72617074746f722f77686f702d73646b2d7068702e737667)](LICENSE)

PHP 8.1+ SDK for the [Whop API](https://docs.whop.com) — payments, memberships, webhooks, and more.

Requirements
------------

[](#requirements)

RequirementVersionPHP^8.1ext-curl\*ext-json\*Installation
------------

[](#installation)

```
composer require rapttor/whop-sdk-php
```

Quick start
-----------

[](#quick-start)

```
use Rapttor\WhopSdk\WhopClient;

$client = new WhopClient(); // reads WHOP_API_KEY from env
```

Set your API key in the environment:

```
export WHOP_API_KEY="your_api_key_here"
```

Or pass it directly:

```
$client = new WhopClient(apiKey: 'your_api_key_here');
```

---

Usage
-----

[](#usage)

### Payments

[](#payments)

```
// List payments — returns a Page object
$page = $client->payments->list([
    'company_id' => 'biz_xxxxxxxxxxxxxx',
    'per_page'   => 10,
]);

foreach ($page->getData() as $payment) {
    echo $payment['id'] . PHP_EOL;
}

// Auto-paginate through ALL pages
foreach ($client->payments->list(['company_id' => 'biz_xxxxxxxxxxxxxx']) as $payment) {
    echo $payment['id'] . PHP_EOL;
}

// Retrieve a single payment
$payment = $client->payments->retrieve('pay_xxxxxxxxxxxxxx', 'biz_xxxxxxxxxxxxxx');
```

### Members

[](#members)

```
foreach ($client->members->list(['company_id' => 'biz_xxxxxxxxxxxxxx']) as $member) {
    echo $member['id'] . PHP_EOL;
}

$member = $client->members->retrieve('mber_xxxxxxxxxxxxx', 'biz_xxxxxxxxxxxxxx');

$client->members->update('mber_xxxxxxxxxxxxx', 'biz_xxxxxxxxxxxxxx', [
    'metadata' => ['tier' => 'gold'],
]);
```

### Memberships

[](#memberships)

```
$membership = $client->memberships->create('biz_xxxxxxxxxxxxxx', [
    'plan_id' => 'plan_xxxxxxxxxxxxxx',
    'user_id' => 'user_xxxxxxxxxxxxxx',
]);

$client->memberships->update($membership['id'], 'biz_xxxxxxxxxxxxxx', ['status' => 'active']);
$client->memberships->delete($membership['id'], 'biz_xxxxxxxxxxxxxx');
```

### Invoices

[](#invoices)

```
$invoice = $client->invoices->create('biz_xxxxxxxxxxxxxx', [
    'collection_method' => 'send_invoice',
    'due_date'          => '2025-12-01T05:00:00.000Z',
    'member_id'         => 'mber_xxxxxxxxxxxxx',
    'plan'              => [],
    'product'           => ['title' => 'My Product'],
]);

$client->invoices->send($invoice['id'], 'biz_xxxxxxxxxxxxxx');
$client->invoices->void($invoice['id'], 'biz_xxxxxxxxxxxxxx');
```

### Users

[](#users)

```
$me = $client->users->me();

// Verify a JWT issued by the Whop iframe / frontend
$result = $client->users->verifyToken($jwtFromFrontend);
$userId = $result['user_id'];

// Check access to an experience
$access = $client->users->checkAccess('exp_xxxxxxxxxxxxxx', ['user_id' => $userId]);
```

### Webhooks

[](#webhooks)

```
// Create a webhook endpoint
$webhook = $client->webhooks->create('biz_xxxxxxxxxxxxxx', [
    'url'    => 'https://yourapp.example.com/webhooks/whop',
    'events' => ['payment.completed', 'membership.created'],
]);

// Verify an incoming webhook (in your controller)
$payload   = (string) file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_WHOP_SIGNATURE'] ?? '';
$secret    = (string) getenv('WHOP_WEBHOOK_SECRET');

use Rapttor\WhopSdk\Resources\Webhooks;

if (!Webhooks::verifySignature($payload, $signature, $secret)) {
    http_response_code(401);
    exit;
}

$event = json_decode($payload, true);
// handle $event ...
```

---

Pagination
----------

[](#pagination)

All `list()` methods return a `Page` object.

```
// Iterate all items across every page automatically
foreach ($client->payments->list(['company_id' => 'biz_xxx']) as $payment) {
    // Pages are fetched on demand
}

// Manual control
$page = $client->payments->list(['company_id' => 'biz_xxx', 'per_page' => 5]);

while (true) {
    foreach ($page->getData() as $payment) { /* ... */ }

    if (!$page->hasNextPage()) break;
    $page = $page->getNextPage();
}

// Cursor info
$info = $page->nextPageInfo(); // ['after' => 'cursor_abc'] or null
```

---

Error handling
--------------

[](#error-handling)

```
use Rapttor\WhopSdk\Exceptions\APIConnectionError;
use Rapttor\WhopSdk\Exceptions\APITimeoutError;
use Rapttor\WhopSdk\Exceptions\AuthenticationError;
use Rapttor\WhopSdk\Exceptions\BadRequestError;
use Rapttor\WhopSdk\Exceptions\NotFoundError;
use Rapttor\WhopSdk\Exceptions\PermissionDeniedError;
use Rapttor\WhopSdk\Exceptions\RateLimitError;
use Rapttor\WhopSdk\Exceptions\InternalServerError;
use Rapttor\WhopSdk\Exceptions\APIStatusError;

try {
    $payment = $client->payments->retrieve('pay_xxx', 'biz_xxx');
} catch (APITimeoutError $e) {
    // Request timed out (after automatic retries)
} catch (APIConnectionError $e) {
    // Could not reach the server
} catch (AuthenticationError $e) {
    // 401 — check your API key
} catch (NotFoundError $e) {
    // 404 — resource does not exist
} catch (RateLimitError $e) {
    // 429 — back off and retry
} catch (APIStatusError $e) {
    // Any other 4xx / 5xx
    echo "HTTP {$e->statusCode}: {$e->getMessage()}" . PHP_EOL;
}
```

### Exception hierarchy

[](#exception-hierarchy)

```
\RuntimeException
└── APIError
    ├── APIConnectionError
    │   └── APITimeoutError
    └── APIStatusError
        ├── BadRequestError          (400)
        ├── AuthenticationError      (401)
        ├── PermissionDeniedError    (403)
        ├── NotFoundError            (404)
        ├── UnprocessableEntityError (422)
        ├── RateLimitError           (429)
        └── InternalServerError      (5xx)

```

---

Retries &amp; timeouts
----------------------

[](#retries--timeouts)

Requests that fail due to connection errors, 408, 409, 429, or 5xx responses are automatically retried with exponential back-off (0.5 s → 1 s → 2 s …, capped at 8 s).

```
// Global defaults
$client = new WhopClient(
    maxRetries: 3,   // default: 2
    timeout:    30,  // default: 60 seconds
);

// Per-request override (returns a new client instance)
$client->withOptions(['max_retries' => 0, 'timeout' => 5])
       ->payments
       ->list(['company_id' => 'biz_xxx']);
```

---

Raw HTTP requests
-----------------

[](#raw-http-requests)

For endpoints not yet covered by a resource class:

```
$data = $client->get('/v5/some/endpoint', ['query_param' => 'value']);
$data = $client->post('/v5/some/endpoint', ['key' => 'value']);
$data = $client->patch('/v5/some/endpoint', ['key' => 'value']);
$data = $client->delete('/v5/some/endpoint');
```

---

Available resources
-------------------

[](#available-resources)

PropertyMethods`$client->accessTokens``list`, `create`, `delete``$client->apps``list`, `retrieve`, `create`, `update``$client->checkoutConfigurations``list`, `retrieve`, `create`, `update``$client->companies``retrieve`, `update``$client->experiences``list`, `retrieve``$client->invoices``list`, `retrieve`, `create`, `send`, `void``$client->members``list`, `retrieve`, `update``$client->memberships``list`, `retrieve`, `create`, `update`, `delete``$client->payments``list`, `retrieve``$client->plans``list`, `retrieve`, `create`, `update``$client->products``list`, `retrieve`, `create`, `update``$client->promoCodes``list`, `retrieve`, `create`, `update`, `delete``$client->refunds``list`, `retrieve`, `create``$client->reviews``list`, `retrieve``$client->users``me`, `retrieve`, `verifyToken`, `checkAccess``$client->webhooks``list`, `retrieve`, `create`, `update`, `delete`, `verifySignature` (static)---

Development
-----------

[](#development)

```
composer install

composer cs        # Check PSR-12 code style
composer cs-fix    # Auto-fix code style
composer analyse   # PHPStan level 8
composer test      # PHPUnit

composer check     # Run all three in sequence
```

---

License
-------

[](#license)

[Apache-2.0](LICENSE) © [rapttor](https://github.com/rapttor)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance57

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/636179fb706f9032bb1fe09f133d88521b2c4e34934c6e3de56decee741591ee?d=identicon)[rapttor](/maintainers/rapttor)

---

Top Contributors

[![rapttor](https://avatars.githubusercontent.com/u/5603881?v=4)](https://github.com/rapttor "rapttor (2 commits)")

### Embed Badge

![Health badge](/badges/rapttor-whop-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/rapttor-whop-sdk-php/health.svg)](https://phpackages.com/packages/rapttor-whop-sdk-php)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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