PHP code example of alphaolomi / php-cellulant

1. Go to this page and download the library: Download alphaolomi/php-cellulant 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/ */

    

alphaolomi / php-cellulant example snippets


use Alphaolomi\CellulantService;

$cellulant = new CellulantService([
    'clientId' => 'your clientId',
    'clientSecret' => 'your clientSecret',
    'apiKey' => 'your api key',
    'serviceCode' => 'your service code',
    'callbackUrl' => 'your callback url',
    'env' => 'sandbox', // or 'production' // default is sandbox
]);


// Authentication
// Get the access token
$authRes = $cellulant->authenticate();
// $authRes is an array with the following keys
// [
//  "token_type" => "bearer",
//  "expires_in" => 3600,
//  "access_token" => "WU3My1AHOcKsnxj3n",
//  "refresh_token" =>   "GSWtHRnJrMHBzdEFPbjhNS0FjODIwMTU1NVlTb3c9PQ=="
// ]

// Checkout Request
$checkoutRes = $cellulant->checkoutRequest([
    // ... Tingg Checkout Request Payload
]);

// Charge Request
$chargeRes = $cellulant->chargeRequest([
    // ... Tingg Charge Request Payload
]);

// Query Status
$queryRes = $cellulant->queryStatus([
    // ... Tingg Checkout Status Payload
]);

// Acknowledgement Request
$ackRes = $cellulant->acknowledgementRequest([
    // ... Tingg Acknowledgement Payload
]);

// Refund Request
$refundRes = $cellulant->refundRequest([
    // ... Tingg Refund Payload
]);
bash
composer