PHPackages                             dodopayments-ismail-taibi/laravel-dodopayments - 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. dodopayments-ismail-taibi/laravel-dodopayments

ActiveLibrary[Payment Processing](/categories/payments)

dodopayments-ismail-taibi/laravel-dodopayments
==============================================

Official Laravel integration for DodoPayments - Accept payments with ease by ismail taibi

02PHP

Since Nov 6Pushed 6mo agoCompare

[ Source](https://github.com/ismadevjs/ismail-taibi-dodo-payment)[ Packagist](https://packagist.org/packages/dodopayments-ismail-taibi/laravel-dodopayments)[ RSS](/packages/dodopayments-ismail-taibi-laravel-dodopayments/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel DodoPayments
====================

[](#laravel-dodopayments)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c866bdb8451f10878b02cef2aa62ba15892d45670444a6b8972ea9a9e0dd319c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646f646f7061796d656e74732f6c61726176656c2d646f646f7061796d656e74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dodopayments/laravel-dodopayments)[![Total Downloads](https://camo.githubusercontent.com/1529c2f3f5228e7bc01ff74a6ac6103429bdb515c51133e9aba94d01c449feda/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646f646f7061796d656e74732f6c61726176656c2d646f646f7061796d656e74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dodopayments/laravel-dodopayments)

Official Laravel package for DodoPayments - Accept payments with ease in your Laravel applications.

Features
--------

[](#features)

- 🚀 **Easy Integration** - Get started in minutes
- 💳 **Checkout Sessions** - Secure hosted checkout pages
- 🔗 **Payment Links** - Static and dynamic payment URLs
- 🔔 **Webhook Support** - Real-time payment notifications
- 🎨 **Beautiful UI** - Pre-built, customizable checkout views
- 🔐 **Secure** - Built-in webhook signature verification
- 📦 **Laravel Standard** - Follows Laravel best practices
- 🎯 **Event-Driven** - Laravel events for all webhooks

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

[](#requirements)

- PHP 8.0 or higher
- Laravel 9.x, 10.x, or 11.x
- A DodoPayments account ([Sign up here](https://app.dodopayments.com))

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

[](#installation)

Install the package via Composer:

```
composer require dodopayments-ismail-taibi/laravel-dodopayments
```

### Publish Configuration

[](#publish-configuration)

Publish the config file:

```
php artisan vendor:publish --tag=dodopayments-config
```

### Publish Views (Optional)

[](#publish-views-optional)

If you want to customize the checkout views:

```
php artisan vendor:publish --tag=dodopayments-views
```

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

[](#configuration)

Add your DodoPayments credentials to your `.env` file:

```
DODO_PAYMENTS_API_KEY=your_api_key_here
DODO_PAYMENTS_PUBLISHABLE_KEY=your_publishable_key_here
DODO_PAYMENTS_WEBHOOK_SECRET=your_webhook_secret_here
DODO_PAYMENTS_ENVIRONMENT=test_mode

# Optional: Customize URLs
DODO_PAYMENTS_SUCCESS_URL=/payment/success
DODO_PAYMENTS_CANCEL_URL=/payment/cancel

# Optional: Product ID for quick testing
DODO_PRODUCT_ID=prod_your_product_id
```

### Getting Your Credentials

[](#getting-your-credentials)

1. **API Key**: Dashboard → Developer → API
2. **Webhook Secret**: Dashboard → Developer → Webhooks
3. **Product ID**: Dashboard → Products → Select Product

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

[](#quick-start)

### 1. Basic Checkout

[](#1-basic-checkout)

The package automatically registers routes. Visit:

```
http://your-app.test/payment/checkout

```

### 2. Create Checkout Programmatically

[](#2-create-checkout-programmatically)

```
use DodoPayments\Laravel\Facades\DodoPayments;

$session = DodoPayments::createCheckoutSession(
    productCart: [
        [
            'product_id' => 'prod_abc123',
            'quantity' => 1,
        ]
    ],
    options: [
        'customer' => [
            'email' => '[email protected]',
            'name' => 'John Doe',
        ],
        'return_url' => url('/payment/success'),
        'metadata' => [
            'order_id' => 'order_123',
        ],
    ]
);

return redirect()->away($session['checkout_url']);
```

### 3. Handle Webhooks

[](#3-handle-webhooks)

The package fires Laravel events for all webhooks. Listen to them in your `EventServiceProvider`:

```
use DodoPayments\Laravel\Events\WebhookReceived;

protected $listen = [
    WebhookReceived::class => [
        \App\Listeners\HandlePaymentSuccess::class,
    ],
];
```

Create a listener:

```
namespace App\Listeners;

use DodoPayments\Laravel\Events\WebhookReceived;
use Illuminate\Support\Facades\Log;

class HandlePaymentSuccess
{
    public function handle(WebhookReceived $event): void
    {
        if ($event->type === 'payment.succeeded') {
            $data = $event->data['data'] ?? [];

            Log::info('Payment successful', [
                'payment_id' => $data['payment_id'] ?? null,
                'amount' => $data['amount'] ?? null,
            ]);

            // Your business logic here
            // Update order status, send emails, etc.
        }
    }
}
```

Usage
-----

[](#usage)

### Create Checkout Session

[](#create-checkout-session)

```
use DodoPayments\Laravel\Facades\DodoPayments;

// Simple checkout
$session = DodoPayments::createCheckoutSession([
    ['product_id' => 'prod_abc123', 'quantity' => 1]
]);

// With customer details
$session = DodoPayments::createCheckoutSession(
    productCart: [
        ['product_id' => 'prod_abc123', 'quantity' => 2],
        ['product_id' => 'prod_xyz789', 'quantity' => 1],
    ],
    options: [
        'customer' => [
            'email' => '[email protected]',
            'name' => 'Jane Smith',
        ],
        'billing_address' => [
            'street' => '123 Main St',
            'city' => 'San Francisco',
            'state' => 'CA',
            'country' => 'US',
            'zipcode' => '94103',
        ],
        'metadata' => [
            'user_id' => auth()->id(),
            'order_id' => 'order_456',
        ],
        'return_url' => url('/orders/success'),
    ]
);

redirect()->away($session['checkout_url']);
```

### Create Payment Link

[](#create-payment-link)

```
// Static payment link
$link = DodoPayments::buildStaticPaymentLink(
    productId: 'prod_abc123',
    params: [
        'quantity' => 1,
        'email' => '[email protected]',
        'redirect_url' => url('/success'),
    ]
);

// Dynamic payment link
$payment = DodoPayments::createPaymentLink(
    productId: 'prod_abc123',
    options: [
        'billing' => [
            'city' => 'New York',
            'country' => 'US',
            'state' => 'NY',
            'street' => '456 Broadway',
            'zipcode' => 10013,
        ],
        'customer' => [
            'email' => '[email protected]',
            'name' => 'Bob Wilson',
        ],
    ]
);

return $payment['payment_link'];
```

### Retrieve Payment

[](#retrieve-payment)

```
$payment = DodoPayments::getPayment('pay_123abc');

echo $payment['status']; // succeeded, failed, pending, etc.
echo $payment['amount'];
echo $payment['customer']['email'];
```

### List Payments

[](#list-payments)

```
$payments = DodoPayments::listPayments([
    'limit' => 10,
    'page' => 1,
]);

foreach ($payments['data'] as $payment) {
    echo $payment['payment_id'];
}
```

Webhook Events
--------------

[](#webhook-events)

The package automatically verifies webhook signatures and fires the `WebhookReceived` event.

### Available Event Types

[](#available-event-types)

- `payment.succeeded` - Payment completed successfully
- `payment.failed` - Payment failed
- `payment.refunded` - Payment was refunded
- `subscription.created` - New subscription created
- `subscription.updated` - Subscription details updated
- `subscription.cancelled` - Subscription cancelled
- `subscription.renewed` - Subscription renewed

### Webhook Configuration

[](#webhook-configuration)

1. In your DodoPayments dashboard, go to Developer → Webhooks
2. Add webhook URL: `https://your-domain.com/webhook/dodopayments`
3. Copy the webhook secret
4. Add to `.env`: `DODO_PAYMENTS_WEBHOOK_SECRET=your_secret`

### Example Webhook Listener

[](#example-webhook-listener)

```
namespace App\Listeners;

use DodoPayments\Laravel\Events\WebhookReceived;
use App\Models\Order;
use Illuminate\Support\Facades\Mail;

class HandlePaymentSuccess
{
    public function handle(WebhookReceived $event): void
    {
        match($event->type) {
            'payment.succeeded' => $this->handlePaymentSuccess($event->data),
            'payment.refunded' => $this->handleRefund($event->data),
            'subscription.created' => $this->handleSubscriptionCreated($event->data),
            default => null,
        };
    }

    private function handlePaymentSuccess(array $data): void
    {
        $paymentData = $data['data'] ?? [];
        $orderId = $paymentData['metadata']['order_id'] ?? null;

        if ($orderId) {
            Order::where('id', $orderId)->update([
                'status' => 'paid',
                'payment_id' => $paymentData['payment_id'],
                'paid_at' => now(),
            ]);

            // Send confirmation email
            Mail::to($paymentData['customer']['email'])
                ->send(new OrderConfirmation($orderId));
        }
    }
}
```

Routes
------

[](#routes)

The package automatically registers these routes:

MethodURINameDescriptionGET`/payment/checkout``dodopayments.checkout`Checkout pagePOST`/payment/checkout``dodopayments.create-checkout`Create checkout sessionGET`/payment/success``dodopayments.success`Success pageGET`/payment/cancel``dodopayments.cancel`Cancel pagePOST`/payment/create-link``dodopayments.create-link`Create payment linkPOST`/webhook/dodopayments``dodopayments.webhook`Webhook endpoint### Disable Auto Routes

[](#disable-auto-routes)

If you want to register routes manually, disable them in config:

```
// config/dodopayments.php
'routes' => [
    'enabled' => false,
],
```

Customization
-------------

[](#customization)

### Custom Views

[](#custom-views)

Publish and customize the views:

```
php artisan vendor:publish --tag=dodopayments-views
```

Views will be available in `resources/views/vendor/dodopayments/`:

- `checkout.blade.php` - Checkout page
- `success.blade.php` - Success page
- `cancel.blade.php` - Cancel page

### Custom Route Prefix

[](#custom-route-prefix)

```
// config/dodopayments.php
'routes' => [
    'prefix' => 'payments', // Changes /payment/* to /payments/*
],
```

Testing
-------

[](#testing)

The package uses the test mode API by default when `DODO_PAYMENTS_ENVIRONMENT=test_mode`.

### Test Locally

[](#test-locally)

```
php artisan serve

# Visit: http://localhost:8000/payment/checkout
```

### Test Webhooks with ngrok

[](#test-webhooks-with-ngrok)

```
ngrok http 8000

# Use the ngrok URL in your DodoPayments webhook settings
# Example: https://abc123.ngrok.io/webhook/dodopayments
```

API Reference
-------------

[](#api-reference)

### Facade Methods

[](#facade-methods)

```
// Create checkout session
DodoPayments::createCheckoutSession(array $productCart, array $options = []): array

// Create payment link
DodoPayments::createPaymentLink(string $productId, array $options = []): array

// Get payment details
DodoPayments::getPayment(string $paymentId): array

// List payments
DodoPayments::listPayments(array $filters = []): array

// Build static payment link
DodoPayments::buildStaticPaymentLink(string $productId, array $params = []): string

// Verify webhook signature
DodoPayments::verifyWebhookSignature(string $payload, array $headers): bool

// Get API URL
DodoPayments::getApiUrl(): string

// Get environment
DodoPayments::getEnvironment(): string
```

Security
--------

[](#security)

- Webhook signatures are automatically verified
- API keys should be stored in `.env` file
- Never commit API keys to version control
- Use HTTPS in production

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Support
-------

[](#support)

- 📧 Email: \[email protected\]
- 📚 Documentation:
- 🐛 Issues: [GitHub Issues](https://github.com/dodopayments/laravel-dodopayments/issues)

License
-------

[](#license)

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

---

Made with ❤️ by [DodoPayments](https://dodopayments.com)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance47

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

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/4cbf2e9a5811b69b1ea70cee0502502d42a8b109b9ffb7e8f2987884895cc46a?d=identicon)[ismadevjs](/maintainers/ismadevjs)

---

Top Contributors

[![ismadevjs](https://avatars.githubusercontent.com/u/61507239?v=4)](https://github.com/ismadevjs "ismadevjs (6 commits)")

### Embed Badge

![Health badge](/badges/dodopayments-ismail-taibi-laravel-dodopayments/health.svg)

```
[![Health](https://phpackages.com/badges/dodopayments-ismail-taibi-laravel-dodopayments/health.svg)](https://phpackages.com/packages/dodopayments-ismail-taibi-laravel-dodopayments)
```

###  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)
