PHP code example of libyaguide / gpay-api-client

1. Go to this page and download the library: Download libyaguide/gpay-api-client 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/ */

    

libyaguide / gpay-api-client example snippets



use GPay\GPayApiClient;
use GPay\BaseUrl;

$client = new GPayApiClient(
    'your_api_key',
    'your_secret_key',
    'your_password',
    BaseUrl::STAGING // or BaseUrl::PRODUCTION
);

// type: Balance
$balance = $client->getBalance();
print_r($balance);

// type: PaymentRequest
$paymentRequest = $client->createPaymentRequest('100.00', 'INV-123', 'Invoice Payment');
print_r($paymentRequest);

// type: PaymentStatus
$status = $client->checkPaymentStatus($paymentRequest->requestId);
print_r($status);

// type: SendMoneyResult
$sendResult = $client->sendMoney('50.00', 'recipient_wallet_id', 'Gift', 'GIFT-001');
print_r($sendResult);

// type: Statement
$statement = $client->getDayStatement('2025-06-22');
print_r($statement);
foreach ($statement->dayStatement as $tx) {
    // tx: StatementTransaction
    print_r($tx);
}

// type: WalletCheck
$walletInfo = $client->checkWallet('recipient_wallet_id');
print_r($walletInfo);

// type: OutstandingTransactions
$outstanding = $client->getOutstandingTransactions();
print_r($outstanding);
foreach ($outstanding->outstandingTransactions as $tx) {
    // tx: OutstandingTransaction
    print_r($tx);
}