PHP code example of laraditz / 2c2p

1. Go to this page and download the library: Download laraditz/2c2p library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

laraditz / 2c2p example snippets


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

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


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

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

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

app('Twoc2p')->paymentInquiry('94a11139-df90-438a-8705-8d88aaa9719e');
bash
php artisan vendor:publish --provider="Laraditz\Twoc2p\Twoc2pServiceProvider" --tag="config"
bash
php artisan migrate