PHP code example of datlechin / sepay-php

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

    

datlechin / sepay-php example snippets


use Datlechin\SePay\SePay;

$client = SePay::client('your_api_key_here');

// Lấy danh sách tài khoản ngân hàng
$bankAccounts = $client->bankAccounts()->list();

// Lấy thông tin một tài khoản cụ thể
$account = $client->bankAccounts()->get($accountId);

// Đếm số lượng tài khoản
$count = $client->bankAccounts()->count();

// Lấy danh sách giao dịch
$transactions = $client->transactions()->list();

// Lấy thông tin một giao dịch cụ thể
$transaction = $client->transactions()->get($transactionId);

// Đếm số lượng giao dịch
$count = $client->transactions()->count();

use Datlechin\SePay\SePay;
use Datlechin\SePay\Webhook\Payload;
use Datlechin\SePay\Webhook\Webhook;

SePay::webhook()
    ->setAuthorization(Webhook::AUTH_API_KEY, 'your_api_key_here')
    ->handle(function (Payload $payload) {
    // Xử lý webhook như lưu thông tin giao dịch hay cập nhật trạng thái đơn hàng...

    return true; // Trả về true để xác nhận webhook hợp lệ hoặc false nếu không hợp lệ
});
bash
composer