PHPackages                             php-junior/laravel-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. php-junior/laravel-2c2p

ActiveLibrary[Payment Processing](/categories/payments)

php-junior/laravel-2c2p
=======================

2C2P Payment Gateway Api &amp; 123 API

1.2(8y ago)446.7k10MITPHPPHP &gt;=5.6.4

Since Aug 2Pushed 8y ago1 watchersCompare

[ Source](https://github.com/PHPJunior/laravel-2c2p)[ Packagist](https://packagist.org/packages/php-junior/laravel-2c2p)[ RSS](/packages/php-junior-laravel-2c2p/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (5)DependenciesVersions (6)Used By (0)

Laravel 2C2P Redirect API , Payment Gateway Api &amp; 123 Api
=============================================================

[](#laravel-2c2p-redirect-api--payment-gateway-api--123-api)

[![StyleCI](https://camo.githubusercontent.com/c0fbab2cdadbe038038a5461227c4f4d3c24659a588b658a49b7f3dac02fbc41/68747470733a2f2f7374796c6563692e696f2f7265706f732f39383937393537312f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/98979571)[![Latest Stable Version](https://camo.githubusercontent.com/51dc3793eafdd7378616f47c9c1a334578a8a8d385ef4f333bb424102a23629b/68747470733a2f2f706f7365722e707567782e6f72672f7068702d6a756e696f722f6c61726176656c2d326332702f762f737461626c65)](https://packagist.org/packages/php-junior/laravel-2c2p)[![Total Downloads](https://camo.githubusercontent.com/d56ce00779c5ad9aab454075e02d5c74124f5a5c2f52072d34d75ba683a313b0/68747470733a2f2f706f7365722e707567782e6f72672f7068702d6a756e696f722f6c61726176656c2d326332702f646f776e6c6f616473)](https://packagist.org/packages/php-junior/laravel-2c2p)

Laravel 2C2P package

Laravel version 5.x.x
---------------------

[](#laravel-version-5xx)

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

[](#installation)

Install using composer:

```
composer require php-junior/laravel-2c2p
```

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php

```
PhpJunior\Laravel2C2P\Laravel2C2PServiceProvider::class,
```

And

```
php artisan vendor:publish --provider="PhpJunior\Laravel2C2P\Laravel2C2PServiceProvider" --force
```

This is the contents of the published config file:

```
return [
    'merchant_id' => 'JT01',
    'secret_key' => '7jYcp4FxFdf0',

    'private_key_pass' => '2c2p',
    'private_key_path' => storage_path('cert/private.pem'),
    'public_key_path' => storage_path('cert/public.crt'),

    'redirect_access_url' => 'https://demo2.2c2p.com/2C2PFrontEnd/RedirectV3/payment',

    'access_url' => 'https://demo2.2c2p.com/2C2PFrontEnd/SecurePayment/PaymentAuth.aspx',
    'secure_pay_script' => 'https://demo2.2c2p.com/2C2PFrontEnd/SecurePayment/api/my2c2p.1.6.9.min.js',

    'currency_code' => 702, // Ref: http://en.wikipedia.org/wiki/ISO_4217
    'country_code' => 'MMR',

    '123_merchant_id' => 'merchant@smarthotel.com',
    '123_api_secret_key' => 'M5WCTP59J544IRRUBTJE0Q7Z2PAJX3CT',
    '123_public_key_path' => storage_path('cert/123.pem'), // 123' Certificate file
    '123_currency_code' => 'MMK',
    '123_country_code' => 'MMR',
    '123_agent_code' => 'ABC',
    '123_channel_code' => 'OVERTHECOUNTER',
    '123_merchant_url' => 'merchant url',
    '123_api_call_url' => 'api call url',
    '123_access_url' => 'https://demo3.2c2p.com/123MM/Payment/Pay/Slip'

    //QuickPay
    'direct_api' => 'http://demo2.2c2p.com/2C2PFrontEnd/QuickPay/DirectAPI',
    'delivery_api' => 'http://demo2.2c2p.com/2C2PFrontEnd/QuickPay/DeliveryAPI'
];
```

#### Payment Request \[ Using the Payment Gateway API and SecurePay \]

[](#payment-request--using-the-payment-gateway-api-and-securepay-)

Construct Payment Form

Add the `data-encrypt` fields into the form to capture card information securely.

```

    My2c2p.onSubmitForm("2c2p-payment-form", function(errCode,errDesc){
        if(errCode!=0){
            alert(errDesc);
        }
    });

```

Submit the request your back end code will receives the encrypted credit card details from the checkout page

##### Preparation

[](#preparation)

```
$payload = \Payment2C2P::paymentRequest([
         'desc' => '1 room for 2 nights',
         'uniqueTransactionCode' => "Invoice".time(),
         'amt' => '1000000',
         'currencyCode' => '702',
         'cardholderName' => 'Card holder Name',
         'cardholderEmail' => 'email@emailcom',
         'panCountry' => 'SG',
         'encCardData' => $request->input('encryptedCardInfo'), // Retrieve encrypted credit card data
         'userDefined1' => 'userDefined1',
         'userDefined2' => 'userDefined2'
     ]);
```

Submit the Payment Request:

```

    Processing payment request, Do not close the browser, press back or refresh the page.

    document.paymentRequestForm.submit();

```

#### Processing the response

[](#processing-the-response)

```
   $response = \Payment2C2P::getData($request->get('paymentResponse'))

   dd($response)
```

#### Payment Request \[ Using 123 API \]

[](#payment-request--using-123-api-)

```
$onwTwoThreeReq = \Payment2C2P::OneTwoThreeRequest([
       'MessageID' => '222222',
       'InvoiceNo' => 'QW232142',
       'Amount'    => 24444,
       'Discount'    => 10,
       'ShippingFee'    => 10,
       'ServiceFee'    => 10,
       'ProductDesc' => '1 room for 2 nights',
       'PayerName' => 'Name',
       'PayerEmail' => 'email@email.com',
       'ShippingAddress' => 'Yangon',
       'PayInSlipInfo' => 'Hello World',
       'PaymentItems' => [
           [
               'id' => 1212,
               'name' => 'Bla Bla',
               'price' => 12222,
               'quantity' => 1
           ],
           [
               'id' => 12,
               'name' => 'Bla Bla#2',
               'price' => 12222,
               'quantity' => 1
           ]
       ]
   ]);
```

Submit the Payment Request:

```

    Processing payment request, Do not close the browser, press back or refresh the page.

    document.paymentRequestForm.submit();

```

#### Processing the response

[](#processing-the-response-1)

```
   $response = \Payment2C2P::getData($request->get('OneTwoThreeRes'))

   dd($response)
```

#### Payment Request \[ Using Redirect API \]

[](#payment-request--using-redirect-api-)

```

    {!! \Payment2C2P::redirectRequest([
            'payment_description' => '2 room 2 night',
            'order_id' => 'QWERZX1234',
            'invoice_no' => 'ZXCQW123',
            'currency' => '840',
            'amount' => '1000',
            'customer_email' => 'email@email.com',
            'result_url_1' => 'http://127.0.0.1:8888/payment/complete'
    ]) !!}
    Submit

```

QuickPay for Card Payments
--------------------------

[](#quickpay-for-card-payments)

QuickPay for Card Payments offers the following options

- QuickPay Direct API - Generate a new QuickPay URL, Merchant to deliver URL to customer (aka white label)
- QuickPay Delivery API - Generate and Send a QuickPay URL to an eMail or mobile phone

#### QuickPay Request \[ Using Direct API \]

[](#quickpay-request--using-direct-api-)

```
    $requestMsg = Payment2C2P::quickPayRequest([
        'orderIdPrefix' => 'QP-zzzz2202',
        'description' => 'asasas',
        'currency' => 'USD',
        'amount' => '10',
        'allowMultiplePayment' => 'N',
        'expiry' => '16092017',
        'resultUrl1' => 'http://61.91.121.190/2c2pfrontend/uat/demomerchant/v3uifrontendurl.aspx', //	Front end return URL
        'resultUrl2' => 'http://61.91.121.190/2c2pfrontend/uat/demomerchant/v3uibackendurl.aspx',  //	Back end return URL
    ], 'generate' );

     $curl = curl_init();
     curl_setopt_array($curl, array(
       CURLOPT_URL => config('laravel-2c2p.direct_api'),
       CURLOPT_RETURNTRANSFER => true,
       CURLOPT_POSTFIELDS => $requestMsg,
     ));

     $response = curl_exec($curl);
     $err = curl_error($curl);

     curl_close($curl);

     if ($err) {
       dd("cURL Error #:" . $err);
     } else {
       dd(base64_decode($response)) ;
     }
```

#### QuickPay Request \[ Using Delivery API \]

[](#quickpay-request--using-delivery-api-)

```
    $requestMsg = Payment2C2P::quickPayRequest([
        'orderIdPrefix' => 'QP-zzzz2202',
        'description' => 'asasas',
        'currency' => 'USD',
        'amount' => '10',
        'allowMultiplePayment' => 'N',
        'expiry' => '16092017',
        'resultUrl1' => 'http://61.91.121.190/2c2pfrontend/uat/demomerchant/v3uifrontendurl.aspx', //	Front end return URL
        'resultUrl2' => 'http://61.91.121.190/2c2pfrontend/uat/demomerchant/v3uibackendurl.aspx',  //	Back end return URL
        'toEmails' => 'email@email.com',
        'emailSubject' => 'Email Subject',
        'emailMessage' => 'Message'
    ], 'generate-send' );

     $curl = curl_init();
     curl_setopt_array($curl, array(
       CURLOPT_URL => config('laravel-2c2p.delivery_api'),
       CURLOPT_RETURNTRANSFER => true,
       CURLOPT_POSTFIELDS => $requestMsg,
     ));

     $response = curl_exec($curl);
     $err = curl_error($curl);

     curl_close($curl);

     if ($err) {
       dd("cURL Error #:" . $err);
     } else {
       dd(base64_decode($response)) ;
     }
```

Send an existing Quickpay URL to an email or mobile phone.

```
    $requestMsg = Payment2C2P::quickPayRequest([
        'qpID' => '121212',
        'toEmails' => 'email@email.com',
        'emailSubject' => 'Email Subject',
        'emailMessage' => 'Message'
    ], 'send-url' );

     $curl = curl_init();
     curl_setopt_array($curl, array(
       CURLOPT_URL => config('laravel-2c2p.delivery_api'),
       CURLOPT_RETURNTRANSFER => true,
       CURLOPT_POSTFIELDS => $requestMsg,
     ));

     $response = curl_exec($curl);
     $err = curl_error($curl);

     curl_close($curl);

     if ($err) {
       dd("cURL Error #:" . $err);
     } else {
       dd(base64_decode($response)) ;
     }
```

QuickPay Query - allows to check the status of an existing QuickPay transaction

```
    $requestMsg = Payment2C2P::quickPayRequest([
        'qpID' => '12122',
    ], 'check' );

     $curl = curl_init();
     curl_setopt_array($curl, array(
       CURLOPT_URL => config('laravel-2c2p.direct_api'),
       CURLOPT_RETURNTRANSFER => true,
       CURLOPT_POSTFIELDS => $requestMsg,
     ));

     $response = curl_exec($curl);
     $err = curl_error($curl);

     curl_close($curl);

     if ($err) {
       dd("cURL Error #:" . $err);
     } else {
       dd(base64_decode($response)) ;
     }
```

QuickPay Update - allows a modification of an existing QuickPay transaction

```
    $requestMsg = Payment2C2P::quickPayRequest([
        'qpID' => '1212',
        'description' => 'asasas',
        'currency' => 'USD',
        'amount' => '10',
    ], 'update' );

     $curl = curl_init();
     curl_setopt_array($curl, array(
       CURLOPT_URL => config('laravel-2c2p.direct_api'),
       CURLOPT_RETURNTRANSFER => true,
       CURLOPT_POSTFIELDS => $requestMsg,
     ));

     $response = curl_exec($curl);
     $err = curl_error($curl);

     curl_close($curl);

     if ($err) {
       dd("cURL Error #:" . $err);
     } else {
       dd(base64_decode($response)) ;
     }
```

QuickPay Delete - allows deletion of an existing QuickPay transaction

```
    $requestMsg = Payment2C2P::quickPayRequest([
        'qpID' => '121212',
    ], 'delete' );

     $curl = curl_init();
     curl_setopt_array($curl, array(
       CURLOPT_URL => config('laravel-2c2p.direct_api'),
       CURLOPT_RETURNTRANSFER => true,
       CURLOPT_POSTFIELDS => $requestMsg,
     ));

     $response = curl_exec($curl);
     $err = curl_error($curl);

     curl_close($curl);

     if ($err) {
       dd("cURL Error #:" . $err);
     } else {
       dd(base64_decode($response)) ;
     }
```

Api Variables
-------------

[](#api-variables)

- Redirect Api variable from [here](https://developer.2c2p.com/docs/redirect-variables).
- Payment Gateway Api variable from [here](https://developer.2c2p.com/docs/api-variables).
- 123 Api from [here](https://developer.2c2p.com/docs/123-payments-123)
- QuickPay variable from [here](https://developer.2c2p.com/docs/quickpay-variables-1)

Full Documentation
------------------

[](#full-documentation)

Read Full Documentation [here](https://developer.2c2p.com/docs)

License
-------

[](#license)

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

Support on Beerpay
------------------

[](#support-on-beerpay)

Hey dude! Help me out for a couple of 🍻!

[![Beerpay](https://camo.githubusercontent.com/cdbb93e00dde70598995676bcd5d896ba6c25614a417248c61803118cb0590a7/68747470733a2f2f626565727061792e696f2f5048504a756e696f722f6c61726176656c2d326332702f62616467652e7376673f7374796c653d626565722d737175617265)](https://beerpay.io/PHPJunior/laravel-2c2p) [![Beerpay](https://camo.githubusercontent.com/31ea5907c19752efcf96b63286ffb80dcc2952cde7ebc3c59be80e249cdb9c91/68747470733a2f2f626565727061792e696f2f5048504a756e696f722f6c61726176656c2d326332702f6d616b652d776973682e7376673f7374796c653d666c61742d737175617265)](https://beerpay.io/PHPJunior/laravel-2c2p?focus=wish)

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Total

5

Last Release

3213d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e2695272c87c7144c984ddf468d380477dc578b617e7da5502eb4e7eff1f6087?d=identicon)[Nyi Nyi Lwin](/maintainers/Nyi%20Nyi%20Lwin)

---

Top Contributors

[![PHPJunior](https://avatars.githubusercontent.com/u/13845077?v=4)](https://github.com/PHPJunior "PHPJunior (24 commits)")

---

Tags

2c2plaravelquickpayquickpay-requestquickpay-urllaravelpaymentvisamaster2c2p123service

### Embed Badge

![Health badge](/badges/php-junior-laravel-2c2p/health.svg)

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

###  Alternatives

[dena-a/iran-payment

a Laravel package to handle Internet Payment Gateways for Iran Banking System

312.4k1](/packages/dena-a-iran-payment)[a17mad/laravel-cybersource

This package wraps the Cybersource SOAP API in a convenient, easy to use package for Laravel.

137.1k](/packages/a17mad-laravel-cybersource)[infyomlabs/laravel-payumoney

Laravel Payumoney Integration Library

114.3k](/packages/infyomlabs-laravel-payumoney)

PHPackages © 2026

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