PHPackages                             uddoktapay/laravel-sdk - 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. uddoktapay/laravel-sdk

ActiveLibrary

uddoktapay/laravel-sdk
======================

UddoktaPay offers a range of payment automation solutions for small entrepreneurs in Bangladesh.

2.1.0(1y ago)22.5k↑25%MITPHPPHP &gt;=7.3.0

Since Jan 24Pushed 1y agoCompare

[ Source](https://github.com/UddoktaPay/LaravelSDK)[ Packagist](https://packagist.org/packages/uddoktapay/laravel-sdk)[ RSS](/packages/uddoktapay-laravel-sdk/feed)WikiDiscussions 2.x Synced 1mo ago

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

UddoktaPay Laravel SDK
======================

[](#uddoktapay-laravel-sdk)

[![UddoktaPay Logo](https://camo.githubusercontent.com/d24aa64800157851a95d528404ea0eae341d03d5c4aecc7e4e362ca5e6190118/68747470733a2f2f7564646f6b74617061792e636f6d2f6173736574732f696d616765732f6c6f676f2e706e67)](https://camo.githubusercontent.com/d24aa64800157851a95d528404ea0eae341d03d5c4aecc7e4e362ca5e6190118/68747470733a2f2f7564646f6b74617061792e636f6d2f6173736574732f696d616765732f6c6f676f2e706e67)

The UddoktaPay Laravel SDK allows you to seamlessly integrate the UddoktaPay payment gateway into your Laravel applications.

---

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
    - [Initializing the SDK](#initializing-the-sdk)
    - [Initializing a Payment](#initializing-a-payment-bangladeshi-methods)
    - [Verifying a Payment](#verifying-a-payment)
    - [Handling IPN Notifications](#handling-ipn-notifications-optional)
    - [Processing Refunds](#processing-refunds-optional)
- [Routes](#routes)
- [Notes](#notes)

---

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

[](#installation)

Install the UddoktaPay Laravel SDK using Composer:

```
composer require uddoktapay/laravel-sdk
```

---

Usage
-----

[](#usage)

### Initializing the SDK

[](#initializing-the-sdk)

Add your UddoktaPay API credentials to the `.env` file:

```
UDDOKTAPAY_API_KEY=your_api_key
UDDOKTAPAY_API_URL=https://sandbox.uddoktapay.com/api/checkout-v2
```

Use the following code to initialize the SDK:

```
use UddoktaPay\LaravelSDK\UddoktaPay;

$uddoktapay = UddoktaPay::make(env('UDDOKTAPAY_API_KEY'), env('UDDOKTAPAY_API_URL'));
```

---

### Initializing a Payment (Bangladeshi Methods)

[](#initializing-a-payment-bangladeshi-methods)

To initiate a payment:

```
use UddoktaPay\LaravelSDK\Requests\CheckoutRequest;

try {
    $checkoutRequest = CheckoutRequest::make()
        ->setFullName('John Doe')
        ->setEmail('john@doe.com')
        ->setAmount('10')
        ->addMetadata('order_id', '12345')
        ->setRedirectUrl(route('uddoktapay.verify'))
        ->setCancelUrl(route('uddoktapay.cancel'))
        ->setWebhookUrl(route('uddoktapay.ipn'));

    $response = $uddoktapay->checkout($checkoutRequest);

    if ($response->failed()) {
        dd($response->message());
    }

    return redirect($response->paymentURL());
} catch (\UddoktaPay\LaravelSDK\Exceptions\UddoktaPayException $e) {
    dd("Initialization Error: " . $e->getMessage());
}
```

---

### Initializing a Payment (Global Methods)

[](#initializing-a-payment-global-methods)

To initiate a payment:

```
use UddoktaPay\LaravelSDK\Requests\CheckoutRequest;

try {
    $checkoutRequest = CheckoutRequest::make()
        ->setFullName('John Doe')
        ->setEmail('john@doe.com')
        ->setAmount('10')
        ->addMetadata('order_id', '12345')
        ->setRedirectUrl(route('uddoktapay.verify'))
        ->setCancelUrl(route('uddoktapay.cancel'))
        ->setWebhookUrl(route('uddoktapay.ipn'));

    $response = $uddoktapay->checkoutGlobal($checkoutRequest);

    if ($response->failed()) {
        dd($response->message());
    }

    return redirect($response->paymentURL());
} catch (\UddoktaPay\LaravelSDK\Exceptions\UddoktaPayException $e) {
    dd("Initialization Error: " . $e->getMessage());
}
```

---

### Verifying a Payment

[](#verifying-a-payment)

After the payment is complete, verify it using the `VerifyResponse` class to understand the structure and available methods for processing the response:

```
try {
    $response = $uddoktapay->verify($request);

    if ($response->success()) {
        // Handle successful status
        dd($response->toArray()); // Handle success
    } elseif ($response->pending()) {
        // Handle pending status
    } elseif ($response->failed()) {
        // Handle failure
    }
} catch (\UddoktaPay\LaravelSDK\Exceptions\UddoktaPayException $e) {
    dd("Verification Error: " . $e->getMessage());
}
```

---

### Handling IPN Notifications (Optional)

[](#handling-ipn-notifications-optional)

To handle Instant Payment Notifications (IPN):

```
try {
    $response = $uddoktapay->ipn($request);

    if ($response->success()) {
        // Handle successful IPN
    } elseif ($response->pending()) {
        // Handle pending IPN
    } elseif ($response->failed()) {
        // Handle failed IPN
    }
} catch (\UddoktaPay\LaravelSDK\Exceptions\UddoktaPayException $e) {
    dd("IPN Error: " . $e->getMessage());
}
```

---

### Processing Refunds (Optional)

[](#processing-refunds-optional)

To process a refund:

```
use UddoktaPay\LaravelSDK\Requests\RefundRequest;

try {
    $refundRequest = RefundRequest::make()
        ->setAmount('10')
        ->setTransactionId('12345')
        ->setPaymentMethod('bkash')
        ->setProductName('Sample Product')
        ->setReason('Customer Request');

    $response = $uddoktapay->refund($refundRequest);

    if ($response->success()) {
        // Handle refund success
    } elseif ($response->failed()) {
        // Handle refund failure
    }
} catch (\UddoktaPay\LaravelSDK\Exceptions\UddoktaPayException $e) {
    dd("Refund Error: " . $e->getMessage());
}
```

---

Routes
------

[](#routes)

Add the following routes to your `web.php` file:

```
use App\Http\Controllers\UddoktaPayController;

Route::get('/checkout', [UddoktaPayController::class, 'checkout'])->name('uddoktapay.checkout');
Route::get('/verify', [UddoktaPayController::class, 'verify'])->name('uddoktapay.verify');
Route::get('/cancel', [UddoktaPayController::class, 'cancel'])->name('uddoktapay.cancel');
Route::post('/ipn', [UddoktaPayController::class, 'ipn'])->name('uddoktapay.ipn');
Route::post('/refund', [UddoktaPayController::class, 'refund'])->name('uddoktapay.refund');
```

---

Notes
-----

[](#notes)

- Replace placeholders like `your_api_key` with actual credentials.
- Use appropriate routes for success, cancel, and IPN handling.
- Always wrap SDK calls with `try-catch` to handle errors effectively.

---

License
-------

[](#license)

This project is open-source and available under the [MIT License](https://opensource.org/licenses/MIT).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance42

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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

Recently: every ~88 days

Total

7

Last Release

464d ago

Major Versions

1.x-dev → 2.02024-12-13

PHP version history (2 changes)1.0.0PHP &gt;=7.4.0

2.0PHP &gt;=7.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a6975c50488b3eeb7cb613bf0b280342ce3912dc4ffaa1aa14b75add8fe070a?d=identicon)[rtraselbd](/maintainers/rtraselbd)

---

Top Contributors

[![rtraselbd](https://avatars.githubusercontent.com/u/31556372?v=4)](https://github.com/rtraselbd "rtraselbd (19 commits)")

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/uddoktapay-laravel-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/uddoktapay-laravel-sdk/health.svg)](https://phpackages.com/packages/uddoktapay-laravel-sdk)
```

PHPackages © 2026

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