{"id":17358718,"url":"https://github.com/phpjunior/laravel-2c2p","last_synced_at":"2025-10-09T23:09:36.760Z","repository":{"id":57039789,"uuid":"98979571","full_name":"PHPJunior/laravel-2c2p","owner":"PHPJunior","description":"Laravel 2C2P package","archived":false,"fork":false,"pushed_at":"2017-10-19T04:17:37.000Z","size":35,"stargazers_count":43,"open_issues_count":0,"forks_count":9,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T03:15:32.491Z","etag":null,"topics":["2c2p","laravel","quickpay","quickpay-request","quickpay-url"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PHPJunior.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-01T08:42:52.000Z","updated_at":"2023-10-06T12:31:41.000Z","dependencies_parsed_at":"2022-08-23T23:30:20.268Z","dependency_job_id":null,"html_url":"https://github.com/PHPJunior/laravel-2c2p","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPJunior%2Flaravel-2c2p","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPJunior%2Flaravel-2c2p/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPJunior%2Flaravel-2c2p/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPJunior%2Flaravel-2c2p/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PHPJunior","download_url":"https://codeload.github.com/PHPJunior/laravel-2c2p/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248978922,"owners_count":21192872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2c2p","laravel","quickpay","quickpay-request","quickpay-url"],"created_at":"2024-10-15T19:06:46.784Z","updated_at":"2025-10-09T23:09:31.730Z","avatar_url":"https://github.com/PHPJunior.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel 2C2P Redirect API , Payment Gateway Api \u0026 123 Api\n\n[![StyleCI](https://styleci.io/repos/98979571/shield?branch=master)](https://styleci.io/repos/98979571)\n[![Latest Stable Version](https://poser.pugx.org/php-junior/laravel-2c2p/v/stable)](https://packagist.org/packages/php-junior/laravel-2c2p)\n[![Total Downloads](https://poser.pugx.org/php-junior/laravel-2c2p/downloads)](https://packagist.org/packages/php-junior/laravel-2c2p)\n\n\nLaravel 2C2P package\n\n## Laravel version 5.x.x\n\n## Installation\n\nInstall using composer:\n```php\ncomposer require php-junior/laravel-2c2p\n```\n\nLaravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.\n\nIf you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php\n\n```php\nPhpJunior\\Laravel2C2P\\Laravel2C2PServiceProvider::class,\n```\n\nAnd \n```php \nphp artisan vendor:publish --provider=\"PhpJunior\\Laravel2C2P\\Laravel2C2PServiceProvider\" --force\n```\n\nThis is the contents of the published config file:\n\n```php\nreturn [\n    'merchant_id' =\u003e 'JT01',\n    'secret_key' =\u003e '7jYcp4FxFdf0',\n\n    'private_key_pass' =\u003e '2c2p',\n    'private_key_path' =\u003e storage_path('cert/private.pem'),\n    'public_key_path' =\u003e storage_path('cert/public.crt'),\n\n    'redirect_access_url' =\u003e 'https://demo2.2c2p.com/2C2PFrontEnd/RedirectV3/payment',\n\n    'access_url' =\u003e 'https://demo2.2c2p.com/2C2PFrontEnd/SecurePayment/PaymentAuth.aspx',\n    'secure_pay_script' =\u003e 'https://demo2.2c2p.com/2C2PFrontEnd/SecurePayment/api/my2c2p.1.6.9.min.js',\n\n    'currency_code' =\u003e 702, // Ref: http://en.wikipedia.org/wiki/ISO_4217\n    'country_code' =\u003e 'MMR',\n\n    '123_merchant_id' =\u003e 'merchant@smarthotel.com',\n    '123_api_secret_key' =\u003e 'M5WCTP59J544IRRUBTJE0Q7Z2PAJX3CT',\n    '123_public_key_path' =\u003e storage_path('cert/123.pem'), // 123' Certificate file\n    '123_currency_code' =\u003e 'MMK',\n    '123_country_code' =\u003e 'MMR',\n    '123_agent_code' =\u003e 'ABC',\n    '123_channel_code' =\u003e 'OVERTHECOUNTER',\n    '123_merchant_url' =\u003e 'merchant url',\n    '123_api_call_url' =\u003e 'api call url',\n    '123_access_url' =\u003e 'https://demo3.2c2p.com/123MM/Payment/Pay/Slip'\n\n    //QuickPay \n    'direct_api' =\u003e 'http://demo2.2c2p.com/2C2PFrontEnd/QuickPay/DirectAPI',\n    'delivery_api' =\u003e 'http://demo2.2c2p.com/2C2PFrontEnd/QuickPay/DeliveryAPI'\n];\n```\n\n#### Payment Request [ Using the Payment Gateway API and SecurePay ]\n\nConstruct Payment Form\n\nAdd the `data-encrypt` fields into the form to capture card information securely.\n\n```html\n\u003cform id=\"2c2p-payment-form\" action=\"\" method=\"POST\"\u003e\n    \u003cinput type=\"text\" data-encrypt=\"cardnumber\" maxlength=\"16\" placeholder=\"Credit Card Number\"\u003e\u003cbr/\u003e\n    \u003cinput type=\"text\" data-encrypt=\"month\" maxlength=\"2\" placeholder=\"MM\"\u003e\u003cbr/\u003e\n    \u003cinput type=\"text\" data-encrypt=\"year\" maxlength=\"4\" placeholder=\"YYYY\"\u003e\u003cbr/\u003e\n    \u003cinput type=\"password\" data-encrypt=\"cvv\" maxlength=\"4\" autocomplete=\"off\" placeholder=\"CVV2/CVC2\" \u003e\u003cbr/\u003e\n    \u003cinput type=\"submit\" value=\"Submit\"\u003e\n\u003c/form\u003e\n\n\u003cscript type=\"text/javascript\" src=\"{{ config('laravel-2c2p.secure_pay_script') }}\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\"\u003e\n    My2c2p.onSubmitForm(\"2c2p-payment-form\", function(errCode,errDesc){\n        if(errCode!=0){ \n            alert(errDesc);\n        }\n    });\n\u003c/script\u003e\n\n```\n\nSubmit the request your back end code will receives the encrypted credit card details from the checkout page\n\n##### Preparation \n\n```php\n$payload = \\Payment2C2P::paymentRequest([\n         'desc' =\u003e '1 room for 2 nights',\n         'uniqueTransactionCode' =\u003e \"Invoice\".time(),\n         'amt' =\u003e '1000000',\n         'currencyCode' =\u003e '702',\n         'cardholderName' =\u003e 'Card holder Name',\n         'cardholderEmail' =\u003e 'email@emailcom',\n         'panCountry' =\u003e 'SG',\n         'encCardData' =\u003e $request-\u003einput('encryptedCardInfo'), // Retrieve encrypted credit card data \n         'userDefined1' =\u003e 'userDefined1',\n         'userDefined2' =\u003e 'userDefined2'\n     ]);\n```\n\nSubmit the Payment Request:\n\n```html\n\u003c!-- POST method to submit the form --\u003e\n\u003cform action='{{ config('laravel-2c2p.access_url') }}' method='POST' name='paymentRequestForm'\u003e\n    Processing payment request, Do not close the browser, press back or refresh the page.\n    \u003cinput type=\"hidden\" name=\"paymentRequest\" value=\"{{ $payload }}\"\u003e\n\u003c/form\u003e\n\u003cscript language=\"JavaScript\"\u003e\n    document.paymentRequestForm.submit();\n\u003c/script\u003e\n```\n\n#### Processing the response\n\n```php\n   $response = \\Payment2C2P::getData($request-\u003eget('paymentResponse'))\n   \n   dd($response)\n```\n\n#### Payment Request [ Using 123 API ]\n\n```php\n$onwTwoThreeReq = \\Payment2C2P::OneTwoThreeRequest([\n       'MessageID' =\u003e '222222',\n       'InvoiceNo' =\u003e 'QW232142',\n       'Amount'    =\u003e 24444,\n       'Discount'    =\u003e 10,\n       'ShippingFee'    =\u003e 10,\n       'ServiceFee'    =\u003e 10,\n       'ProductDesc' =\u003e '1 room for 2 nights',\n       'PayerName' =\u003e 'Name',\n       'PayerEmail' =\u003e 'email@email.com',\n       'ShippingAddress' =\u003e 'Yangon',\n       'PayInSlipInfo' =\u003e 'Hello World',\n       'PaymentItems' =\u003e [\n           [\n               'id' =\u003e 1212,\n               'name' =\u003e 'Bla Bla',\n               'price' =\u003e 12222,\n               'quantity' =\u003e 1\n           ],\n           [\n               'id' =\u003e 12,\n               'name' =\u003e 'Bla Bla#2',\n               'price' =\u003e 12222,\n               'quantity' =\u003e 1\n           ]\n       ]\n   ]);\n```\n\nSubmit the Payment Request:\n\n```html\n\u003c!-- POST method to submit the form --\u003e\n\u003cform action='{{ config('laravel-2c2p.123_access_url') }}' method='POST' name='paymentRequestForm'\u003e\n    Processing payment request, Do not close the browser, press back or refresh the page.\n    \u003cinput type=\"hidden\" name=\"OneTwoThreeReq\" value=\"{{ $onwTwoThreeReq }}\"\u003e\n\u003c/form\u003e\n\u003cscript language=\"JavaScript\"\u003e\n    document.paymentRequestForm.submit();\n\u003c/script\u003e\n```\n\n#### Processing the response\n\n```php\n   $response = \\Payment2C2P::getData($request-\u003eget('OneTwoThreeRes'))\n   \n   dd($response)\n```\n\n#### Payment Request [ Using Redirect API ]\n\n```php\n\u003cform action=\"{{ config('laravel-2c2p.redirect_access_url') }}\"  method=\"POST\"\u003e\n    {!! \\Payment2C2P::redirectRequest([\n            'payment_description' =\u003e '2 room 2 night',\n            'order_id' =\u003e 'QWERZX1234',\n            'invoice_no' =\u003e 'ZXCQW123',\n            'currency' =\u003e '840',\n            'amount' =\u003e '1000',\n            'customer_email' =\u003e 'email@email.com',\n            'result_url_1' =\u003e 'http://127.0.0.1:8888/payment/complete'\n    ]) !!}\n    \u003cbutton type=\"submit\"\u003eSubmit\u003c/button\u003e\n\u003c/form\u003e\n```\n\n## QuickPay for Card Payments\n\nQuickPay for Card Payments offers the following options\n- QuickPay Direct API - Generate a new QuickPay URL, Merchant to deliver URL to customer (aka white label)\n- QuickPay Delivery API - Generate and Send a QuickPay URL to an eMail or mobile phone\n\n#### QuickPay Request [ Using Direct API ]\n```php\n    $requestMsg = Payment2C2P::quickPayRequest([\n        'orderIdPrefix' =\u003e 'QP-zzzz2202',\n        'description' =\u003e 'asasas',\n        'currency' =\u003e 'USD',\n        'amount' =\u003e '10',\n        'allowMultiplePayment' =\u003e 'N',\n        'expiry' =\u003e '16092017',\n        'resultUrl1' =\u003e 'http://61.91.121.190/2c2pfrontend/uat/demomerchant/v3uifrontendurl.aspx', //\tFront end return URL\n        'resultUrl2' =\u003e 'http://61.91.121.190/2c2pfrontend/uat/demomerchant/v3uibackendurl.aspx',  //\tBack end return URL\n    ], 'generate' );\n\n     $curl = curl_init();\n     curl_setopt_array($curl, array(\n       CURLOPT_URL =\u003e config('laravel-2c2p.direct_api'),\n       CURLOPT_RETURNTRANSFER =\u003e true,\n       CURLOPT_POSTFIELDS =\u003e $requestMsg,\n     ));\n\n     $response = curl_exec($curl);\n     $err = curl_error($curl);\n    \n     curl_close($curl);\n    \n     if ($err) {\n       dd(\"cURL Error #:\" . $err);\n     } else {\n       dd(base64_decode($response)) ;\n     }\n```\n\n#### QuickPay Request [ Using Delivery API ]\n```php\n    $requestMsg = Payment2C2P::quickPayRequest([\n        'orderIdPrefix' =\u003e 'QP-zzzz2202',\n        'description' =\u003e 'asasas',\n        'currency' =\u003e 'USD',\n        'amount' =\u003e '10',\n        'allowMultiplePayment' =\u003e 'N',\n        'expiry' =\u003e '16092017',\n        'resultUrl1' =\u003e 'http://61.91.121.190/2c2pfrontend/uat/demomerchant/v3uifrontendurl.aspx', //\tFront end return URL\n        'resultUrl2' =\u003e 'http://61.91.121.190/2c2pfrontend/uat/demomerchant/v3uibackendurl.aspx',  //\tBack end return URL\n        'toEmails' =\u003e 'email@email.com',\n        'emailSubject' =\u003e 'Email Subject',\n        'emailMessage' =\u003e 'Message'\n    ], 'generate-send' );\n\n     $curl = curl_init();\n     curl_setopt_array($curl, array(\n       CURLOPT_URL =\u003e config('laravel-2c2p.delivery_api'),\n       CURLOPT_RETURNTRANSFER =\u003e true,\n       CURLOPT_POSTFIELDS =\u003e $requestMsg,\n     ));\n\n     $response = curl_exec($curl);\n     $err = curl_error($curl);\n    \n     curl_close($curl);\n    \n     if ($err) {\n       dd(\"cURL Error #:\" . $err);\n     } else {\n       dd(base64_decode($response)) ;\n     }\n```\n\nSend an existing Quickpay URL to an email or mobile phone.\n\n```php\n    $requestMsg = Payment2C2P::quickPayRequest([\n        'qpID' =\u003e '121212',\n        'toEmails' =\u003e 'email@email.com',\n        'emailSubject' =\u003e 'Email Subject',\n        'emailMessage' =\u003e 'Message'\n    ], 'send-url' );\n\n     $curl = curl_init();\n     curl_setopt_array($curl, array(\n       CURLOPT_URL =\u003e config('laravel-2c2p.delivery_api'),\n       CURLOPT_RETURNTRANSFER =\u003e true,\n       CURLOPT_POSTFIELDS =\u003e $requestMsg,\n     ));\n\n     $response = curl_exec($curl);\n     $err = curl_error($curl);\n    \n     curl_close($curl);\n    \n     if ($err) {\n       dd(\"cURL Error #:\" . $err);\n     } else {\n       dd(base64_decode($response)) ;\n     }\n```\n\nQuickPay Query - allows to check the status of an existing QuickPay transaction\n\n```php\n    $requestMsg = Payment2C2P::quickPayRequest([\n        'qpID' =\u003e '12122',\n    ], 'check' );\n\n     $curl = curl_init();\n     curl_setopt_array($curl, array(\n       CURLOPT_URL =\u003e config('laravel-2c2p.direct_api'),\n       CURLOPT_RETURNTRANSFER =\u003e true,\n       CURLOPT_POSTFIELDS =\u003e $requestMsg,\n     ));\n\n     $response = curl_exec($curl);\n     $err = curl_error($curl);\n    \n     curl_close($curl);\n    \n     if ($err) {\n       dd(\"cURL Error #:\" . $err);\n     } else {\n       dd(base64_decode($response)) ;\n     }\n```\n\nQuickPay Update - allows a modification of an existing QuickPay transaction\n\n```php\n    $requestMsg = Payment2C2P::quickPayRequest([\n        'qpID' =\u003e '1212',\n        'description' =\u003e 'asasas',\n        'currency' =\u003e 'USD',\n        'amount' =\u003e '10',\n    ], 'update' );\n\n     $curl = curl_init();\n     curl_setopt_array($curl, array(\n       CURLOPT_URL =\u003e config('laravel-2c2p.direct_api'),\n       CURLOPT_RETURNTRANSFER =\u003e true,\n       CURLOPT_POSTFIELDS =\u003e $requestMsg,\n     ));\n\n     $response = curl_exec($curl);\n     $err = curl_error($curl);\n    \n     curl_close($curl);\n    \n     if ($err) {\n       dd(\"cURL Error #:\" . $err);\n     } else {\n       dd(base64_decode($response)) ;\n     }\n```\n\nQuickPay Delete - allows deletion of an existing QuickPay transaction\n\n```php\n    $requestMsg = Payment2C2P::quickPayRequest([\n        'qpID' =\u003e '121212',\n    ], 'delete' );\n\n     $curl = curl_init();\n     curl_setopt_array($curl, array(\n       CURLOPT_URL =\u003e config('laravel-2c2p.direct_api'),\n       CURLOPT_RETURNTRANSFER =\u003e true,\n       CURLOPT_POSTFIELDS =\u003e $requestMsg,\n     ));\n\n     $response = curl_exec($curl);\n     $err = curl_error($curl);\n    \n     curl_close($curl);\n    \n     if ($err) {\n       dd(\"cURL Error #:\" . $err);\n     } else {\n       dd(base64_decode($response)) ;\n     }\n```\n\n## Api Variables\n\n- Redirect Api variable from [here](https://developer.2c2p.com/docs/redirect-variables).\n- Payment Gateway Api variable from [here](https://developer.2c2p.com/docs/api-variables).\n- 123 Api from [here](https://developer.2c2p.com/docs/123-payments-123)\n- QuickPay variable from [here](https://developer.2c2p.com/docs/quickpay-variables-1)\n\n## Full Documentation\n\nRead Full Documentation [here](https://developer.2c2p.com/docs)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n## Support on Beerpay\nHey dude! Help me out for a couple of :beers:!\n\n[![Beerpay](https://beerpay.io/PHPJunior/laravel-2c2p/badge.svg?style=beer-square)](https://beerpay.io/PHPJunior/laravel-2c2p)  [![Beerpay](https://beerpay.io/PHPJunior/laravel-2c2p/make-wish.svg?style=flat-square)](https://beerpay.io/PHPJunior/laravel-2c2p?focus=wish)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpjunior%2Flaravel-2c2p","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpjunior%2Flaravel-2c2p","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpjunior%2Flaravel-2c2p/lists"}