faso-dev/orange-money-burkina-sdk

该包是一个API,封装了Orange Money Burkina的基本API。

v2.beta 2021-12-11 00:33 UTC

This package is auto-updated.

Last update: 2024-10-01 00:10:33 UTC


README

Orange Money Burkina基本API的非官方SDK,以便开发者在PHP项目中更方便地使用和集成。

通过composer安装

composer require faso-dev/orange-money-burkina-sdk

使用案例

use Fasodev\Sdk\Config\TransactionData;
use Fasodev\Sdk\Exception\TransactionException;
use Fasodev\Sdk\OrangeMoneyAPI;
use Fasodev\Sdk\PaymentSDK;

require_once __DIR__ . '/vendor/autoload.php';

try {
    $orangeApi = (new OrangeMoneyAPI("username", "password", "merchant_number"))
                ->withTransactionData(TransactionData::from('client_number', 'payment_amount', 'otp_code'))
                ->withCustomReference("123456778") //optionnal
                ->useProdApi() // for production
                ->withoutSSLVerification() //if you have any troubleshoot with ssl verifcation(not recommended)
    ;
    $response = (new PaymentSDK($orangeApi))->handlePayment();
    echo 'Thank you for your purchasse !';
    echo $response->getTransactionId();
} catch (TransactionException $exception) {
    echo "Whoops! Unable to process payment. <br/> 
          Error message returned by request: {$exception->getMessage()}. <br/>
          Error code returned by request: {$exception->getCode()}";
}

测试

使用以下命令执行测试

vendor/bin/phpunit

composer tests

作者

感谢您的贡献!