dohone/payment

支付API 向客户收费意味着将此表单发送到DOHONE,由您的系统正确填写。

1.0.5 2023-02-14 17:05 UTC

This package is auto-updated.

Last update: 2024-09-14 21:21:07 UTC


README

如果您希望客户通过Orange Money、MTN Mobile Money、Express Union Mobile或DOHONE转账支付,在您的移动应用程序和网站(带或不带DOHONE图形界面)上,原理很简单。

功能

  1. 制作报价
  2. 通过Web界面进行支付
  3. 无Web界面进行支付
  4. 进行短信验证
  5. 进行支付验证
  6. 向手机支付
  7. 向后台账户支付

用法

步骤1

安装(使用Composer)

composer require dohone/payment

步骤2

配置

$ php artisan vendor:publish --provider="Dohone\DohonePayServiceProvider"

步骤3

更新您的config/dohone.php配置文件,包含您的商家哈希码

return [
   'merchantToken' => 'XXXXXXXX',
    'currency' => 'XAF',
    'projectName' => env('APP_NAME', "Dohone"),
    'projectLogo' => 'https:///assets/images/logo.png',
    'endPage' => env('APP_URL', "https://"),
    'payInNotifyPage' => env('APP_URL', "https://"),
    'cancelPage' => env('APP_URL', "https://"),
    'language' => 'fr',
    'method' => '1, 2, 3, 10, 17',
    'numberNotifs' => 5,
    'payInUrl' => env("DOHONE_SANDBOX",false) ? 'https://www.my-dohone.com/dohone-sandbox/pay' : 'https://www.my-dohone.com/dohone/pay',

    'payOutHashCode' => 'XXXXXXXX',
    'payOutPhoneAccount' => 'XXXXXXXX',
    'payOutNotifyPage' => env('APP_URL', "https://"),
    'payOutUrl' => env("DOHONE_SANDBOX",false) ? 'https://www.my-dohone.com/dohone-sandbox/transfert' : 'https://www.my-dohone.com/dohone/transfert',
   ];

步骤4: (可选)

使用沙箱账户启用调试模式(请确保在生产环境中删除此行或将它设置为false)

DOHONE_SANDBOX=true

收银API和Web

1. 制作报价

$response = DohonePayIn::quotation()
        ->setAmount(123)
        ->setFeedsLevel(4)
        ->setMethod(DohonePayIn::quotation()::MTN)
        ->get();
     if ($response->isSuccess()) {
    //success code goes here
        echo $response->getMessage();
    } else {
    //error code goes here
        echo $response->getMessage();
    }

2. 使用Web界面进行支付

 $builder = DohonePayIn::payWithUI()
        ->setAmount(123)
        ->setClientPhone("695499969")
        ->setClientEmail("yann@email.com")
        ->setCommandID("aazertyuiop");
    try {
         return   $builder->getView();
    }catch (Exception $exception){
        //Return error view
        return $builder->getErrors();
    }

3. 使用API REST进行支付(您需要授权才能使用此方法)

$response = DohonePayIn::payWithAPI()
        ->setAmount(123)
        ->setClientPhone("the phone of the user")
        ->setClientEmail("the email of the user")
        ->setCommandID("your order unique id")
        ->setOTPCode(123456)
        ->setMethod(DohonePayIn::quotation()::ORANGE)
        ->get();
     if ($response->isSuccess()) {
    //success code goes here
        echo $response->getMessage();
    } else {
    //error code goes here
        echo $response->getMessage();
    }

4. 进行短信验证

$response = DohonePayIn::sms()
        ->setCode("the code receive by SMS")
        ->setPhone("the phone which has receive the SMS")
        ->get();
    if ($response->isSuccess()) {
    //success code goes here
        echo $response->getMessage();
    } else {
    //error code goes here
        echo $response->getMessage();
    }

5. 进行支付验证

$response = DohonePayIn::verify()
        ->setAmount(6546545)
        ->setCommandID("your command unique id")
        ->setPaymentToken("the ttoken receive after the successful payment")
        ->get();
    if ($response->isSuccess()) {
    //success code goes here
        echo $response->getMessage();
    } else {
    //error code goes here
        echo $response->getMessage();
    }

支付API

1. 向手机支付

$response = DohonePayOut::mobile()
        ->setAmount("amount to send")
        ->setMethod(6)
        ->setReceiverAccount('receiver phone number with country country code ex:237XXXXXX')
        ->setReceiverCity("city")
        ->setReceiverCountry("country name")
        ->setReceiverName("receiver name")
        ->post();
    if ($response->isSuccess()) {
    //success code goes here
        echo $response->getMessage();
    } else {
    //error code goes here
        echo $response->getMessage();
    }

每个响应对象方法返回