定制 papihack/paytech-php-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

papihack/paytech-php-client

Composer 安装命令:

composer require papihack/paytech-php-client

包简介

A PHP Client or SDK for PayTech Online Payment Gateway.

README 文档

README

Coverage Status Issues PR Latest Stable Version Total Downloads Latest Unstable Version License Open Source Love png1

This is a simple SDK Client or API Client for PayTech Online Payment Gateway.

Check out PayTech SN Website.

How to use it

First of all, install the package or library via composer

  • composer require papihack/paytech-php-client

After that, setup the API config with your parameters like this :

    \PayTech\Config::setApiKey('your_api_key');
    \PayTech\Config::setApiSecret('your_api_secret');

    /*
     * you can set one of this two environment TEST or PROD
     * you can just set the env mode via \PayTech\Enums\Env::TEST or \PayTech\Enums\Env::PROD
     * Like the following example
     * !!! By default env is PROD !!!
     * You can also directly set test or prod as a string if you want
     * Like \PayTech\Config::setEnv('test') or \PayTech\Config::setEnv('prod')
    */

    \PayTech\Config::setEnv(\PayTech\Enums\Env::PROD);

    /*
     * The PayTech\Enums\Currency class defined authorized currencies
     * You can change XOF (in the following example) by USD, CAD or another currency
     * All allowed currencies are in \PayTech\Enums\Currency class
     * !!! Notice that XOF is the default currency !!!
    */

    \PayTech\Config::setCurrency(\PayTech\Enums\Currency::XOF);

    /* !!! Note that if you decide to set the ipn_url, it must be in https !!! */

    \PayTech\Config::setIpnUrl('your_ipn_url');
    \PayTech\Config::setSuccessUrl('your_success_url');
    \PayTech\Config::setCanceUrl('your_cancel_url');

    /*
     * if you want the mobile success or cancel page, you can set
     * the following parameter
    */

    \PayTech\Config::setIsMobile(true);

Then you can proceed with :

    $article_price = 15000;
    $article = new \PayTech\Invoice\InvoiceItem('article_name', $article_price, 'command_name', 'ref_command');

    /* You can also add custom data or fields like this */

    \PayTech\CustomField::set('your_field_name', 'your_field_value');

    /* Make the payment request demand to the API */

    \PayTech\PayTech::send($article);

    /* Get the API Response */

    $response = [
        'success'      => \PayTech\ApiResponse::getSuccess(),
        'errors'       => \PayTech\ApiResponse::getErrors(),
        'token'        => \PayTech\ApiResponse::getToken(),
        'redirect_url' => \PayTech\ApiResponse::getRedirectUrl(),
    ];

After that, if you have a success response, you can redirect your user to the $response['redirect_url'] so that he can make the payment.
You can process the response as you wish by directly manipulating \PayTech\ApiResponse.

TODO

  • tests: cover all use cases ✅
  • get the support team at paytech.sn to clarify certain points

Contributing

Feel free to make a PR or report an issue 😃

Regarding the tests, I use the elegant PHP Testing Framework Pest 😎

Oh, one more thing, please do not forget to put a description when you make your PR 🙂

Contributors

统计信息

  • 总下载量: 83
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 2
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固