PHPackages                             moneybag/moneybag-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. [API Development](/categories/api)
4. /
5. moneybag/moneybag-sdk-php

ActiveLibrary[API Development](/categories/api)

moneybag/moneybag-sdk-php
=========================

Official PHP SDK for Moneybag Payment Gateway

v1.0.0-beta.1(11mo ago)023MITPHPPHP &gt;=7.4CI failing

Since Jul 28Pushed 11mo agoCompare

[ Source](https://github.com/Moneybag-SDK/moneybag-sdk-php)[ Packagist](https://packagist.org/packages/moneybag/moneybag-sdk-php)[ Docs](https://github.com/moneybag/moneybag-sdk-php)[ RSS](/packages/moneybag-moneybag-sdk-php/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (5)Versions (2)Used By (0)

Moneybag PHP SDK
================

[](#moneybag-php-sdk)

[![Latest Version](https://camo.githubusercontent.com/d0e7aaa9ba0f6783ca118672f897ee24b0c84d71b20185fbb78b0674a1953218/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d76312e302e302d2d626574612e312d6f72616e6765)](https://github.com/moneybag/moneybag-sdk-php)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)[![PHP Version](https://camo.githubusercontent.com/1acc5809031941bf175aeb9537fe0b60dee9fadd01557b445f648887b6cef78d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344372e342d383839324246)](https://php.net)[![Build Status](https://camo.githubusercontent.com/b0c6c6845a74cb65a7f0a32bdcfd8fbf80eeb40026c4029af424ab371c94b8bd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c642d70617373696e672d627269676874677265656e)](https://github.com/moneybag/moneybag-sdk-php)

Official PHP SDK for Moneybag Payment Gateway. Simplify payment integration in your PHP applications with our easy-to-use SDK supporting checkout and payment verification.

> ⚠️ **Beta Release**: This is a beta version for testing and feedback. Not recommended for production use yet.

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

[](#requirements)

- PHP 7.4 or higher
- Composer
- Guzzle HTTP client

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

[](#installation)

### For Beta Testing

[](#for-beta-testing)

```
composer require moneybag/moneybag-sdk-php:^1.0@beta
```

Or add to your `composer.json`:

```
{
    "require": {
        "moneybag/moneybag-sdk-php": "^1.0@beta"
    }
}
```

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

[](#quick-start)

### Initialize the Client

[](#initialize-the-client)

```
use Moneybag\MoneybagClient;

// Using default base URL (staging)
$client = new MoneybagClient('your_merchant_api_key');

// Or with custom base URL (e.g., from environment variable)
$client = new MoneybagClient('your_merchant_api_key', [
    'base_url' => $_ENV['MONEYBAG_API_URL'] ?? 'https://staging.api.moneybag.com.bd/api/v2'
]);
```

### Create a Checkout Session

[](#create-a-checkout-session)

```
use Moneybag\Models\CheckoutRequest;

$checkoutData = [
    'order_id' => 'order123',
    'currency' => 'BDT',
    'order_amount' => '1280.00',
    'order_description' => 'Online purchase',
    'success_url' => 'https://yourdomain.com/payment/success',
    'cancel_url' => 'https://yourdomain.com/payment/cancel',
    'fail_url' => 'https://yourdomain.com/payment/fail',
    'customer' => [
        'name' => 'John Doe',
        'email' => 'john@example.com',
        'address' => '123 Main Street',
        'city' => 'Dhaka',
        'postcode' => '1000',
        'country' => 'Bangladesh',
        'phone' => '+8801700000000'
    ]
];

try {
    $request = new CheckoutRequest($checkoutData);
    $response = $client->createCheckout($request);

    // Redirect customer to checkout URL
    header('Location: ' . $response->getCheckoutUrl());
} catch (MoneybagException $e) {
    // Handle error
    echo 'Error: ' . $e->getMessage();
}
```

### Verify Payment

[](#verify-payment)

```
$transactionId = $_GET['transaction_id']; // Get from callback

try {
    $response = $client->verifyPayment($transactionId);

    if ($response->isSuccessful()) {
        // Payment successful
        echo 'Payment completed for order: ' . $response->getOrderId();
    } else {
        // Payment failed
        echo 'Payment failed with status: ' . $response->getStatus();
    }
} catch (MoneybagException $e) {
    // Handle error
    echo 'Error: ' . $e->getMessage();
}
```

Configuration Options
---------------------

[](#configuration-options)

```
$client = new MoneybagClient('your_api_key', [
    'base_url' => 'https://api.moneybag.com.bd/api/v2',  // API base URL
    'timeout' => 30,                                      // Request timeout in seconds
    'verify_ssl' => true,                                 // SSL certificate verification
]);

// Or set base URL after initialization
$client->setBaseUrl('https://api.moneybag.com.bd/api/v2');
```

Advanced Usage
--------------

[](#advanced-usage)

### Order Items

[](#order-items)

```
$checkoutData['order_items'] = [
    [
        'sku' => 'PROD001',
        'product_name' => 'iPhone 15',
        'product_category' => 'Electronic',
        'quantity' => 1,
        'unit_price' => '1200.00',
        'vat' => '120.00',
        'net_amount' => '1320.00'
    ]
];
```

### Shipping Information

[](#shipping-information)

```
$checkoutData['shipping'] = [
    'name' => 'John Doe',
    'address' => '123 Main Street',
    'city' => 'Dhaka',
    'postcode' => '1000',
    'country' => 'Bangladesh'
];
```

### Payment Information

[](#payment-information)

```
$checkoutData['payment_info'] = [
    'is_recurring' => false,
    'installments' => 0,
    'allowed_payment_methods' => ['card', 'mobile_banking'],
    'requires_emi' => false
];
```

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

[](#error-handling)

The SDK throws specific exceptions for different error scenarios:

```
use Moneybag\Exceptions\ValidationException;
use Moneybag\Exceptions\ApiException;
use Moneybag\Exceptions\MoneybagException;

try {
    // SDK operations
} catch (ValidationException $e) {
    // Handle validation errors
} catch (ApiException $e) {
    // Handle API errors
} catch (MoneybagException $e) {
    // Handle general SDK errors
}
```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

Examples
--------

[](#examples)

Check the `examples` directory for complete implementation examples:

- `examples/checkout.php` - Complete checkout flow
- `examples/verify.php` - Payment verification

Support
-------

[](#support)

For support, email  or visit our [documentation](https://docs.moneybag.com.bd).

Beta Version Notice
-------------------

[](#beta-version-notice)

This is a **beta release** (v1.0.0-beta.1) intended for testing and feedback.

### What to Expect

[](#what-to-expect)

- Core functionality is complete and tested
- API may undergo minor changes before stable release
- We welcome bug reports and feature requests
- Not recommended for production use yet

### Providing Feedback

[](#providing-feedback)

Please report issues or suggestions on our [GitHub Issues](https://github.com/moneybag/moneybag-sdk-php/issues) page.

### Roadmap to Stable Release

[](#roadmap-to-stable-release)

- Gather community feedback
- Address any reported issues
- Finalize API design
- Performance optimizations
- Additional payment method support
- Enhanced error messages

License
-------

[](#license)

This SDK is released under the MIT License. See the LICENSE file for details.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance51

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity22

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

341d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cca91c0f572d2945cb1b3800b89bcb1993010356c0f1a81f5844037f8a26010f?d=identicon)[moneybag](/maintainers/moneybag)

---

Top Contributors

[![mahabubul-dev](https://avatars.githubusercontent.com/u/190241238?v=4)](https://github.com/mahabubul-dev "mahabubul-dev (5 commits)")

---

Tags

composerpayment-gatewaypayment-integrationphpphpapisdkpaymentgatewaypayment gatewaybangladeshmoneybag

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.6M13](/packages/checkout-checkout-sdk-php)[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k9.5M89](/packages/openai-php-laravel)[resend/resend-php

Resend PHP library.

617.2M43](/packages/resend-resend-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[clicksend/clicksend-php

351.6M11](/packages/clicksend-clicksend-php)[postfinancecheckout/sdk

PostFinance Checkout SDK for PHP

22241.1k22](/packages/postfinancecheckout-sdk)

PHPackages © 2026

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