https://github.com/bilions-org/2c2p-php
2c2p payment gateway Redirect PHP-SDK
https://github.com/bilions-org/2c2p-php
2c2p 2c2p-laravel 2c2p-php
Last synced: 6 months ago
JSON representation
2c2p payment gateway Redirect PHP-SDK
- Host: GitHub
- URL: https://github.com/bilions-org/2c2p-php
- Owner: bilions-org
- License: mit
- Created: 2022-08-10T15:55:04.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-08-19T06:23:18.000Z (almost 4 years ago)
- Last Synced: 2025-09-26T03:54:17.003Z (10 months ago)
- Topics: 2c2p, 2c2p-laravel, 2c2p-php
- Language: PHP
- Homepage: https://developer.2c2p.com/docs/redirect-api-how-it-works
- Size: 18.6 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README

# 2c2p-PHP Library 
## Usage
#### Step 1. Setup 2c2p Credentials
```
use CCPP\Config;
use CCPP\Locale;
$config = Config::init();
$config->merchantId = 'JT02';
$config->secretKey = '72B8F060B3B923E580411200068A764610F61034AE729AB9EF20CAFF93AFA1B9';
$config->currencyCode = 'MMK';
$config->locale = Locale::MYANMAR;
$config->baseUrl = BaseUrl::SANDBOX;
```
#### Step 2. Prepare redirect API request payload
```
use CCPP\Requests\RedirectApiRequest;
$invoiceNo = uniqid(); // Your invoice Number
$request = new RedirectApiRequest();
$request->amount = 10000;
$request->frontendReturnUrl = 'https://example.com/';
$request->description = 'Invoice Description';
$request->invoiceNo = $invoiceNo;
$request->paymentChannel = [PaymentChannel::CREDIT_CARD];
$request->customerName = 'Zin Kyaw Kyaw';
$request->customerEmail = 'necessarylion@gmail.com';
```
#### Step 3. Get redirect Url
```
use CCPP\RedirectApi;
$payment = new RedirectApi();
$url = $payment->getUrl($request);
```
#### Step 4. Store payment token and invoiceNo in your database
```
$paymentToken = $payload->paymentToken();
```
#### Step 5. On frontendReturnUrl inquiry payment using paymentToken and invoiceNo
```
$result = $payment->inquiryPayment(); // return PaymentInquiryResponse
$success = $payment->inquiryStatus(); // return boolean (true or false)
```
#### Other additional helpful functions
- `$payment->response()` get full api response