dohone / payment
Pay-out API To charge a customer, this means to send this form to DOHONE duly filled in by your system.
1.0.5
2023-02-14 17:05 UTC
Requires
- guzzlehttp/guzzle: ^7.2
Requires (Dev)
- orchestra/testbench: ^6.0
README
If you wish to make your customers pay by Orange Money, MTN Mobile Money, Express Union Mobile or DOHONE transfert, on your mobile application and your website with or without a DOHONE graphic interface, the principle is simple.
Features
- Make Quotation
- Make Payment with Web interface
- Make Payment without Web interface
- Make SMS verification
- Make payment verification
- Make payout to mobile phone
- Make payout to back account
Usage
Step 1:
Installation (with Composer)
composer require dohone/payment
Step 2:
Configuration
$ php artisan vendor:publish --provider="Dohone\DohonePayServiceProvider"
Step 3:
Update your config/dohone.php
config with your merchand hashcode
return [ 'merchantToken' => 'XXXXXXXX', 'currency' => 'XAF', 'projectName' => env('APP_NAME', "Dohone"), 'projectLogo' => 'http://localhost/assets/images/logo.png', 'endPage' => env('APP_URL', "http://localhost"), 'payInNotifyPage' => env('APP_URL', "http://localhost"), 'cancelPage' => env('APP_URL', "http://localhost"), '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', "http://localhost"), 'payOutUrl' => env("DOHONE_SANDBOX",false) ? 'https://www.my-dohone.com/dohone-sandbox/transfert' : 'https://www.my-dohone.com/dohone/transfert', ];
Step 4: (optional)
Enable debugger mode by using sandbox account (Please make sure to delete the line or set it to false in production)
DOHONE_SANDBOX=true
PAYIN API AND WEB
1. Make Quotation
$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. Make Payment using Web interface
$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. Make Payment with API REST (You need authorization to use this method)
$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. Make SMS verification
$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. Make payment verification
$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(); }
PAYOUT API
1. Make payout to mobile phone
$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(); }