PHPackages                             saba-ab/rapyd - 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. [API Development](/categories/api)
4. /
5. saba-ab/rapyd

ActiveLibrary[API Development](/categories/api)

saba-ab/rapyd
=============

Full-featured Laravel SDK for the Rapyd fintech API

v1.2.0(2mo ago)01↓91.7%[1 PRs](https://github.com/saba-ab/rapyd/pulls)AGPL-3.0-onlyPHPPHP ^8.2CI passing

Since Mar 24Pushed 2mo agoCompare

[ Source](https://github.com/saba-ab/rapyd)[ Packagist](https://packagist.org/packages/saba-ab/rapyd)[ Docs](https://github.com/saba-ab/rapyd)[ GitHub Sponsors](https://github.com/saba-ab)[ RSS](/packages/saba-ab-rapyd/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (30)Versions (5)Used By (0)

Rapyd Laravel SDK
=================

[](#rapyd-laravel-sdk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/83468841aa1807c3e684b3effe6dadb06bfbb7f91c6df88093e59e514f14e7d7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736162612d61622f72617079642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/saba-ab/rapyd)[![GitHub Tests Action Status](https://camo.githubusercontent.com/b29600bc4a8a9fbcb08b40b2cb8d96d9f54d16d22bfe6847b3329e4bd4e4707d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736162612d61622f72617079642f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/saba-ab/rapyd/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/3f7c89cb19732589ce2717c2ce3bc1be977e95df3f98196bbe590a8822230f1a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736162612d61622f72617079642f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/saba-ab/rapyd/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/047383239c03625b4a909f86e4cf8e81bd56168a120c7916d81ce09bd0f94482/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736162612d61622f72617079642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/saba-ab/rapyd)

A full-featured Laravel package for the Rapyd fintech API covering payments, payouts, wallets, card issuing, verification, and fraud protection.

Features
--------

[](#features)

- HMAC-SHA256 request signing handled automatically
- Typed DTOs for all API response objects with enum status fields
- Resource classes covering all 6 Rapyd domains (100+ endpoints)
- Webhook signature verification with Laravel event dispatch (50+ event types)
- Auto-pagination via LazyCollection for memory-efficient iteration
- 24 PHP 8.2+ backed enums for all status and type fields
- Artisan commands for testing connectivity and exploring payment methods
- Built on spatie/laravel-package-tools for clean Laravel integration

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

[](#requirements)

- PHP 8.2+
- Laravel 11.x, 12.x, or 13.x
- Rapyd API keys (get them at [dashboard.rapyd.net](https://dashboard.rapyd.net))

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

[](#installation)

Install the package via Composer:

```
composer require saba-ab/rapyd
```

Publish the configuration file:

```
php artisan vendor:publish --tag="rapyd-config"
```

Add your API keys to `.env`:

```
RAPYD_ACCESS_KEY=rak_your_access_key
RAPYD_SECRET_KEY=rsk_your_secret_key
RAPYD_SANDBOX=true
```

Quick Start
-----------

[](#quick-start)

### Create a payment

[](#create-a-payment)

```
use Sabaab\Rapyd\Facades\Rapyd;

$payment = Rapyd::payments()->create([
    'amount' => 100,
    'currency' => 'USD',
    'payment_method' => [
        'type' => 'us_visa_card',
        'fields' => [
            'number' => '4111111111111111',
            'expiration_month' => '12',
            'expiration_year' => '25',
            'cvv' => '123',
            'name' => 'John Doe',
        ],
    ],
]);

echo $payment->id;       // "payment_abc123"
echo $payment->status;   // PaymentStatus::Active
echo $payment->amount;   // 100.0
```

### List customers with auto-pagination

[](#list-customers-with-auto-pagination)

```
// Lazy iteration - fetches pages on demand, memory-efficient
foreach (Rapyd::customers()->all() as $customer) {
    echo $customer->name . "\n";
}

// Eager collection
$customers = Rapyd::customers()->list(['limit' => 50])->collect();
```

### Retrieve a payment

[](#retrieve-a-payment)

```
$payment = Rapyd::payments()->get('payment_abc123');
echo $payment->paid;         // true
echo $payment->currencyCode; // "USD"
```

Available Resources
-------------------

[](#available-resources)

### Collect (Payments)

[](#collect-payments)

AccessorDescription`Rapyd::payments()`Create, retrieve, update, cancel, capture payments`Rapyd::refunds()`Create, retrieve, update refunds`Rapyd::customers()`Manage customers and payment methods`Rapyd::checkout()`Create and retrieve checkout pages`Rapyd::paymentMethods()`List payment methods by country, get required fields`Rapyd::paymentLinks()`Create and manage payment links`Rapyd::subscriptions()`Manage subscriptions`Rapyd::plans()`Manage subscription plans`Rapyd::products()`Manage products`Rapyd::invoices()`Create, manage, finalize, and pay invoices`Rapyd::disputes()`Retrieve and list disputes`Rapyd::escrows()`Release escrow funds### Disburse (Payouts)

[](#disburse-payouts)

AccessorDescription`Rapyd::payouts()`Create, confirm, cancel payouts`Rapyd::payoutMethods()`List payout method types and required fields`Rapyd::beneficiaries()`Manage payout beneficiaries`Rapyd::senders()`Manage payout senders### Wallet

[](#wallet)

AccessorDescription`Rapyd::wallets()`Create and manage e-wallets`Rapyd::walletContacts()`Manage wallet contacts`Rapyd::walletTransfers()`Transfer between wallets`Rapyd::walletTransactions()`View wallet transactions`Rapyd::virtualAccounts()`Issue and manage virtual accounts### Issuing (Cards)

[](#issuing-cards)

AccessorDescription`Rapyd::cards()`Issue, activate, manage cards`Rapyd::cardPrograms()`Manage card programs### Verify (KYC/KYB)

[](#verify-kyckyb)

AccessorDescription`Rapyd::identities()`Create and check identity verifications`Rapyd::verification()`Create hosted verification pages### Protect &amp; Data

[](#protect--data)

AccessorDescription`Rapyd::fraud()`Get and update fraud settings`Rapyd::data()`List countries, currencies, FX ratesWebhooks
--------

[](#webhooks)

The package auto-registers a POST route at `/rapyd/webhook` (configurable) with automatic signature verification.

### Configure in Rapyd Dashboard

[](#configure-in-rapyd-dashboard)

Set your webhook URL in the [Rapyd Client Portal](https://dashboard.rapyd.net) to:

```
https://your-app.com/rapyd/webhook

```

### Listen for events

[](#listen-for-events)

```
use Sabaab\Rapyd\Webhooks\Events\PaymentCompletedEvent;

Event::listen(PaymentCompletedEvent::class, function (PaymentCompletedEvent $event) {
    $payment = $event->payment; // Hydrated Payment DTO

    Order::where('payment_id', $payment->id)->update(['status' => 'paid']);
});
```

### Catch-all listener

[](#catch-all-listener)

```
use Sabaab\Rapyd\Webhooks\Events\RapydWebhookReceived;

Event::listen(RapydWebhookReceived::class, function (RapydWebhookReceived $event) {
    Log::info("Rapyd webhook: {$event->type}", $event->data);
});
```

### Available event types

[](#available-event-types)

Events are dispatched for all 65 Rapyd webhook types, grouped by domain:

- **Payment**: PaymentCompleted, PaymentSucceeded, PaymentFailed, PaymentExpired, PaymentUpdated, PaymentCaptured, PaymentCanceled
- **Refund**: RefundCompleted, RefundFailed, RefundRejected, PaymentRefundCompleted, PaymentRefundFailed, PaymentRefundRejected
- **Customer**: CustomerCreated, CustomerUpdated, CustomerDeleted, CustomerPaymentMethodCreated/Updated/Deleted/Expiring
- **Subscription**: SubscriptionCreated, SubscriptionUpdated, SubscriptionCompleted, SubscriptionCanceled, SubscriptionPastDue, SubscriptionTrialEnd, SubscriptionRenewed
- **Invoice**: InvoiceCreated, InvoiceUpdated, InvoicePaymentCreated/Succeeded/Failed
- **Payout**: PayoutCompleted, PayoutUpdated, PayoutFailed, PayoutExpired, PayoutCanceled, PayoutReturned
- **Wallet**: WalletTransaction, WalletFundsAdded/Removed, WalletTransferCompleted/Failed/ResponseReceived
- **Card Issuing**: CardIssuingAuthApproved/Declined, CardIssuingSale, CardIssuingCredit, and more
- **Verify**: VerifyApplicationSubmitted/Approved/Rejected
- **Virtual Account**: VirtualAccountCreated/Updated/Closed/Transaction

Artisan Commands
----------------

[](#artisan-commands)

```
# Test API connectivity
php artisan rapyd:test-connection

# List payment methods for a country
php artisan rapyd:list-payment-methods US

# View webhook configuration
php artisan rapyd:webhook-info
```

Configuration
-------------

[](#configuration)

After publishing, the configuration file is at `config/rapyd.php`:

```
return [
    // API credentials
    'access_key' => env('RAPYD_ACCESS_KEY', ''),
    'secret_key' => env('RAPYD_SECRET_KEY', ''),

    // Set to false for production
    'sandbox' => env('RAPYD_SANDBOX', true),

    // Base URLs (override only if needed)
    'base_url' => [
        'sandbox' => 'https://sandboxapi.rapyd.net',
        'production' => 'https://api.rapyd.net',
    ],

    // Webhook settings
    'webhook' => [
        'path' => env('RAPYD_WEBHOOK_PATH', '/rapyd/webhook'),
        'tolerance' => env('RAPYD_WEBHOOK_TOLERANCE', 60), // seconds
        'middleware' => [],
    ],

    // HTTP timeout in seconds
    'timeout' => env('RAPYD_TIMEOUT', 30),

    // Retry on 5xx errors
    'retry' => [
        'times' => env('RAPYD_RETRY_TIMES', 3),
        'sleep' => env('RAPYD_RETRY_SLEEP', 100), // milliseconds
    ],
];
```

DTOs and Enums
--------------

[](#dtos-and-enums)

All API responses are returned as typed DTOs with `readonly` properties:

```
$payment = Rapyd::payments()->get('payment_abc');

$payment->id;           // string
$payment->amount;       // float
$payment->status;       // ?PaymentStatus enum
$payment->createdAt;    // ?Carbon
$payment->paid;         // bool
$payment->address;      // ?Address (nested DTO)
```

Use enums for type-safe comparisons:

```
use Sabaab\Rapyd\Enums\PaymentStatus;

if ($payment->status === PaymentStatus::Closed) {
    // Payment completed successfully
}
```

Available enums: `PaymentStatus`, `PaymentMethodCategory`, `PaymentFlowType`, `NextAction`, `RefundStatus`, `DisputeStatus`, `PayoutStatus`, `PayoutMethodCategory`, `SubscriptionStatus`, `InvoiceStatus`, `WebhookStatus`, `CardStatus`, `CardBlockReasonCode`, `EntityType`, `FeeCalcType`, `FixedSide`, `WalletContactType`, `CouponDuration`, `PlanInterval`, `CheckoutPageStatus`, `EscrowStatus`, `IssuingTxnType`, `Environment`, `WebhookEventType`.

Pagination
----------

[](#pagination)

```
// Lazy iteration - pages fetched on demand
foreach (Rapyd::customers()->all() as $customer) {
    echo $customer->name;
}

// Eager collection
$all = Rapyd::payments()->list(['limit' => 50])->collect();

// First item only (fetches just 1 item)
$first = Rapyd::payments()->list()->first();

// Convert to array
$array = Rapyd::customers()->list()->toArray();
```

Error Handling
--------------

[](#error-handling)

```
use Sabaab\Rapyd\Exceptions\ApiException;
use Sabaab\Rapyd\Exceptions\AuthenticationException;
use Sabaab\Rapyd\Exceptions\ValidationException;
use Sabaab\Rapyd\Exceptions\RapydException;

try {
    $payment = Rapyd::payments()->create([...]);
} catch (AuthenticationException $e) {
    // Invalid API keys
} catch (ValidationException $e) {
    // Invalid fields - $e->fields contains details
} catch (ApiException $e) {
    // API error - $e->errorCode, $e->operationId
} catch (RapydException $e) {
    // Base exception for all Rapyd errors
}
```

Testing
-------

[](#testing)

Use `Http::fake()` to mock Rapyd API responses in your tests:

```
use Illuminate\Support\Facades\Http;
use Sabaab\Rapyd\Facades\Rapyd;

Http::fake([
    'sandboxapi.rapyd.net/v1/payments' => Http::response([
        'status' => ['status' => 'SUCCESS', 'error_code' => ''],
        'data' => ['id' => 'payment_test', 'amount' => 100, 'paid' => true],
    ]),
]);

$payment = Rapyd::payments()->create(['amount' => 100, 'currency' => 'USD']);
```

Run the package test suite:

```
composer test          # Run Pest tests
composer test-coverage # Run tests with coverage
composer format        # Fix code style with Laravel Pint
composer analyse       # Run PHPStan + Larastan
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/saba-ab/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [saba-ab](https://github.com/saba-ab)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance86

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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

Total

3

Last Release

78d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/388b54f2297ab931cd3b9ef3eaeb940cd43277a6f2286dd87fbdb6c2c51f8b83?d=identicon)[saba-ab](/maintainers/saba-ab)

---

Top Contributors

[![saba-ab](https://avatars.githubusercontent.com/u/129981493?v=4)](https://github.com/saba-ab "saba-ab (7 commits)")

---

Tags

laravelRapydsaba-ab

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/saba-ab-rapyd/health.svg)

```
[![Health](https://phpackages.com/badges/saba-ab-rapyd/health.svg)](https://phpackages.com/packages/saba-ab-rapyd)
```

###  Alternatives

[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.7M64](/packages/spatie-laravel-responsecache)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k9.9M89](/packages/dedoc-scramble)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[stechstudio/laravel-hubspot

A Laravel SDK for the HubSpot CRM Api

3076.9k](/packages/stechstudio-laravel-hubspot)

PHPackages © 2026

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