PHPackages                             adamnatad/laravel-ntpayments - 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. adamnatad/laravel-ntpayments

ActiveLibrary[Payment Processing](/categories/payments)

adamnatad/laravel-ntpayments
============================

Modular Payment Gateway Integration Package for Laravel and Flutter (Xendit, Paymongo)

11PHPCI passing

Since Feb 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/AdamNatad/Laravel-NTPayments)[ Packagist](https://packagist.org/packages/adamnatad/laravel-ntpayments)[ RSS](/packages/adamnatad-laravel-ntpayments/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel-NTPayments
==================

[](#laravel-ntpayments)

[![Run Package Tests](https://github.com/adamnatad/laravel-ntpayments/actions/workflows/run-tests.yml/badge.svg)](https://github.com/adamnatad/laravel-ntpayments/actions)[![Latest Stable Version](https://camo.githubusercontent.com/e1cdabba3b7638a37d0f92110e6c11003bb4bdd35726e3afb4f0d868b08e60a6/68747470733a2f2f706f7365722e707567782e6f72672f6164616d6e617461642f6c61726176656c2d6e747061796d656e74732f76657273696f6e)](https://packagist.org/packages/adamnatad/laravel-ntpayments)[![Total Downloads](https://camo.githubusercontent.com/a780b7a2ce09b0829b9b1ad106ead4c95e30aaeac7e3e77be3f2c0ad48f318d4/68747470733a2f2f706f7365722e707567782e6f72672f6164616d6e617461642f6c61726176656c2d6e747061796d656e74732f642f746f74616c)](https://packagist.org/packages/adamnatad/laravel-ntpayments)[![License](https://camo.githubusercontent.com/5bea6aae58014ec011c7f208f94e73eb3d754edc396e6d6f4e5a030d4541e2cd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6164616d6e617461642f6c61726176656c2d6e747061796d656e74732e737667)](LICENSE)

A **modular and scalable** payment gateway integration for Laravel, supporting **Xendit** and **PayMongo** with **automatic currency conversion**, **dynamic payment method validation** and **configurable transaction IDs**.

---

**🚀 Features**
--------------

[](#-features)

✔ **Supports Multiple Payment Gateways** → Xendit &amp; PayMongo (More coming soon!)
✔ **Automatic Currency Conversion** → Converts between preferred and secondary currencies.
✔ **Dynamic Payment Method Validation** → Ensures only supported methods are used.
✔ **Configurable Transaction ID Format** → `{PREFIX}_{GATEWAY}_{UNIQUEID}_{TIMESTAMP}`
✔ **Programmatic Conversion Rate Override** → Developers can adjust conversion rates dynamically per request.
✔ **Retrieve Unique Transaction IDs** → Ensures traceable and globally unique transaction tracking.
✔ **Modular &amp; Extensible** → Easily add new gateways without modifying core logic.

---

**📦 Installation**
------------------

[](#-installation)

Install the package via Composer:

```
composer require adamnatad/laravel-ntpayments
```

Then, publish the configuration file:

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

This will create:

```
config/ntpayments.php
```

---

**⚙️ Configuration**
--------------------

[](#️-configuration)

### **1️⃣ Set API Credentials**

[](#1️⃣-set-api-credentials)

Update your `.env` file with your payment gateway credentials:

```
XENDIT_SECRET_KEY=your_xendit_api_key
PAYMONGO_SECRET_KEY=your_paymongo_api_key
```

### **2️⃣ Define Default Payment Settings**

[](#2️⃣-define-default-payment-settings)

Modify `config/ntpayments.php` to set:

```
return [
    'default_gateway' => env('PAYMENT_GATEWAY', 'xendit'),

    'preferred_currency' => 'USD',
    'secondary_currency' => 'PHP',
    'conversion_rate' => 54.30,

    'transaction_prefix' => 'NTP', // Custom transaction prefix
];
```

---

**🛠 Usage**
-----------

[](#-usage)

### **✅ Processing a Payment**

[](#-processing-a-payment)

```
use AdamNatad\LaravelNTPayments\Facades\NTPayments;

$response = NTPayments::createPayment([
    'amount' => 1000,
    'currency' => 'USD',
    'gateway' => 'xendit',
    'payment_type' => 'credit_card',
]);

dd($response);
```

### **✅ Fetch Available Payment Methods**

[](#-fetch-available-payment-methods)

```
$methods = NTPayments::getMethods('xendit');
dd($methods);
```

### **✅ Get Available Currencies**

[](#-get-available-currencies)

```
$currencies = NTPayments::getCurrencies('paymongo');
dd($currencies);
```

### **✅ Retrieve Conversion Rate**

[](#-retrieve-conversion-rate)

```
$rate = NTPayments::getConversionRate();
dd($rate);
```

### **✅ Override Conversion Rate (For Current Request)**

[](#-override-conversion-rate-for-current-request)

```
$ntp = new NTPayments();
$ntp->setConversionRate(55.00);
$rate = $ntp->getConversionRate();
dd($rate);
```

### **✅ Generate a Unique Transaction ID**

[](#-generate-a-unique-transaction-id)

The transaction ID is generated using the following format:

```
{PREFIX}_{GATEWAY}_{UNIQUEID}_{TIMESTAMP}

```

- **PREFIX** → Defined in `config/ntpayments.php` (`transaction_prefix`, default: `NTP`)
- **GATEWAY** → The selected payment gateway (e.g., `XENDIT`, `PAYMONGO`)
- **UNIQUEID** → A secure 10-character unique identifier generated via `bin2hex(random_bytes(5))`
- **TIMESTAMP** → The Unix timestamp at the time of transaction creation

```
$transactionId = NTPayments::generateTransactionId('xendit');
dd($transactionId);
```

**Example Output:**

```
NTP_XENDIT_65AB2C7F12D_1719214023
```

### **✅ Charge a Payment**

[](#-charge-a-payment)

```
$chargeResponse = NTPayments::charge(1000, 'USD', 'credit_card', 'xendit');
dd($chargeResponse);
```

### **✅ Retrieve Payment Details**

[](#-retrieve-payment-details)

> **Note:** The payment ID used here (`invoice_12345`) is the unique invoice ID **returned by Xendit** when processing a payment. This is **not** the same as the internally generated transaction ID (`NTP_XENDIT_65AB2C7F12D_1719214023`). When retrieving payment details, always use the invoice ID provided by Xendit.

```
$paymentDetails = NTPayments::getPaymentDetails('xendit', 'invoice_12345');
dd($paymentDetails);
```

### **✅ Retrieve Payment Status**

[](#-retrieve-payment-status)

> **Note:** Similar to retrieving payment details, the payment ID used here (`invoice_12345`) is the unique invoice ID **returned by Xendit** when processing a payment. This is **not** the same as the internally generated transaction ID (`NTP_XENDIT_65AB2C7F12D_1719214023`). When retrieving payment status, always use the invoice ID provided by Xendit.

```
$paymentStatus = NTPayments::getPaymentStatus('xendit', 'invoice_12345');
dd($paymentStatus);
```

---

**📜 License**
-------------

[](#-license)

This package is open-source and licensed under the **MIT License**.

---

**📞 Support &amp; Contributions**
---------------------------------

[](#-support--contributions)

Pull requests and feature suggestions are welcome! If you encounter any issues, feel free to open an issue on GitHub.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

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/22bf08f0b947be440b9623d7d7049de34525ff1923e32df25c0dea90fff2a207?d=identicon)[AdamNatad](/maintainers/AdamNatad)

---

Top Contributors

[![AdamNatad](https://avatars.githubusercontent.com/u/99297839?v=4)](https://github.com/AdamNatad "AdamNatad (13 commits)")

### Embed Badge

![Health badge](/badges/adamnatad-laravel-ntpayments/health.svg)

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

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