PHPackages                             laraditz/2c2p - 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. laraditz/2c2p

ActiveLibrary[Payment Processing](/categories/payments)

laraditz/2c2p
=============

Simple laravel package for 2C2P Payment Gateway

1.0.1(3y ago)42098MITPHPPHP ^7.4|^8.0

Since Oct 14Pushed 2y ago1 watchersCompare

[ Source](https://github.com/laraditz/2c2p)[ Packagist](https://packagist.org/packages/laraditz/2c2p)[ Docs](https://github.com/laraditz/2c2p)[ RSS](/packages/laraditz-2c2p/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (4)Used By (0)

Laravel 2C2P Payment Gateway
============================

[](#laravel-2c2p-payment-gateway)

[![Latest Version on Packagist](https://camo.githubusercontent.com/01d16666d533962bf7a04ab0a48a1075ed64d14baf045cfe497b884759cd0eb3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6172616469747a2f326332702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laraditz/2c2p)[![Total Downloads](https://camo.githubusercontent.com/d7e0080a736d2d8fc66a57b5315e96d285653f04e572f5e77d5f90d05788023c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6172616469747a2f326332702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laraditz/2c2p)[![License](https://camo.githubusercontent.com/9a41d17da33b1b22a2d188046e1e0df751a81c14622ec28e2a0d3e3403a1e5cf/68747470733a2f2f706f7365722e707567782e6f72672f6c6172616469747a2f326332702f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/laraditz/2c2p)

Simple laravel package for 2C2P Payment Gateway.

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

[](#installation)

You can install the package via composer:

```
composer require laraditz/2c2p
```

Before Start
------------

[](#before-start)

Configure your variables in your `.env` (recommended) or you can publish the config file and change it there.

```
2C2P_MERCHANT_ID=
2C2P_MERCHANT_SECRET=
2C2P_CURRENCY_CODE=
2C2P_SANDBOX_MODE=true # true or false for sandbox mode

```

(Optional) You can publish the config file via this command:

```
php artisan vendor:publish --provider="Laraditz\Twoc2p\Twoc2pServiceProvider" --tag="config"
```

Run the migration command to create the necessary database table.

```
php artisan migrate
```

Available Methods
-----------------

[](#available-methods)

Below are all methods available under this package.

Method nameDescriptioncreatePayment()Create a new payment and get payment URL.paymentInquiry()Inquire on payment details.encodeJWT()Encode content based on 2c2p rules.decodeJWT()Decode content based on 2c2p rules.Usage
-----

[](#usage)

You can use service container or facade.

```
// Using service container
app('Twoc2p')->createPayment($data);

// Using facade
\Twoc2p::createPayment($data);
```

### Create Payment

[](#create-payment)

To create payment and get the payment URL to be redirected to.

ParameterTypeDescriptioninvoiceNostringUnique invoice NumberdescriptionstringDescription of the paymentamountdecimalThe amount of paymentfrontendReturnUrlstringRedirect to this URL once payment completeExample as below:

```
app('Twoc2p')->createPayment([
    'invoiceNo' => '1523953661',
    'description' => 'item 1',
    'amount' => 100.00,
    'frontendReturnUrl' => 'http://domain.test/your-return-url',
]);
```

Return example:

```
array:2 [
  "id" => "94a19a34-965a-4e11-acd2-7acb02696f18"
  "payment_url" => "https://sandbox-pgw-ui.2c2p.com/payment/4.1/#/token/kSAops9Zwhos8hSTSeLTUxxx"
]
```

Redirect to the `payment_url` to proceed to 2C2P payment page. Once done, you will be redirected to the `frontendReturnUrl`. Below is the sample response returned.

```
{
	"invoiceNo": "280520075921",
	"channelCode": "CC",
	"respCode": "2000",
	"respDesc": "Transaction is completed, please do payment inquiry request for full payment information."
}
```

### Payment Inquiry

[](#payment-inquiry)

To inquire on payment details.

ParameterTypeDescriptionpayment\_idstringPayment ID from create payment.Example as below:

```
app('Twoc2p')->paymentInquiry('94a11139-df90-438a-8705-8d88aaa9719e');
```

Event
-----

[](#event)

This package also provide some events to allow your application to listen to it. You can create your listener and register it under event below.

EventDescriptionLaraditz\\Twoc2p\\Events\\BackendReceivedReceived backend response from 2C2P for a payment. Can use to update your payment status and other details### Changelog

[](#changelog)

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

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

[](#contributing)

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

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Raditz Farhan](https://github.com/laraditz)

License
-------

[](#license)

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

References
----------

[](#references)

- [2C2P Developer Zone](https://developer.2c2p.com/docs)
- [2C2P Recipes](https://developer.2c2p.com/recipes)
- [2C2P API Reference](https://developer.2c2p.com/reference)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

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

Total

2

Last Release

1449d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1203676?v=4)[Raditz Farhan](/maintainers/raditzfarhan)[@raditzfarhan](https://github.com/raditzfarhan)

---

Top Contributors

[![raditzfarhan](https://avatars.githubusercontent.com/u/1203676?v=4)](https://github.com/raditzfarhan "raditzfarhan (18 commits)")

---

Tags

laraditz2c2p

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laraditz-2c2p/health.svg)

```
[![Health](https://phpackages.com/badges/laraditz-2c2p/health.svg)](https://phpackages.com/packages/laraditz-2c2p)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k108.5M873](/packages/laravel-socialite)[linkxtr/laravel-qrcode

A clean, modern, and easy-to-use QR code generator for Laravel

3720.4k](/packages/linkxtr-laravel-qrcode)

PHPackages © 2026

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