PHP code example of pallapay / pallapay-php-sdk

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

    

pallapay / pallapay-php-sdk example snippets


use Pallapay\PallapaySDK\PallapayClient;

$apiKey = "YOUR_API_KEY";
$secretKey = "YOUR_SECRET_KEY";
$pallapayClient = new PallapayClient($apiKey, $secretKey);

$createdPayment = $pallapayClient->payment()->create(
    'AED',
    '100',
    '[email protected]',
    'https://yourwebsite.com/success',
    'https://yourwebsite.com/failed',
    'https://yourwebsite.com/webhook', // Optional
    'John', // Optional
    'Doe', // Optional
    'My Custom Note', // Optional
    'Order ID' // Optional
    //'USDT', // (paymentCurrencySymbol => Force the user to pay only in the selected currency, for example: USDT, ETH, ...) Optional
);

echo $createdPayment["data"]["payment_link"];

use Pallapay\PallapaySDK\PallapayClient;

$apiKey = "YOUR_API_KEY";
$secretKey = "YOUR_SECRET_KEY";
$pallapayClient = new PallapayClient($apiKey, $secretKey);

$jsonData = file_get_contents('php://input');
$data = json_decode($inputJson, TRUE);

$ipnData = $pallapayClient->payment()->getIpnData($data);

if ($ipnData->isValid() && $ipnData->isPaid()) {
    print_r($ipnData->getAll())
    echo 'Paid Successfully';
} else {
    echo 'Not Paid';
}

composer