Search by

dohone / payment

Yann-Yvan

Pay-out API To charge a customer, this means to send this form to DOHONE duly filled in by your system.

1.0.8 2026-11-30 08:41 UTC

This package is auto-updated.

Last update: 2026-11-30 08:51:36 UTC


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

  1. Make Quotation
  2. Make Payment with Web interface
  3. Make Payment without Web interface
  4. Make SMS verification
  5. Make payment verification
  6. Make payout to mobile phone
  7. 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 (API Exchange, tutorial v1.1.12)

Since 1.1.0 the payout uses the Dohone API Exchange (intent: cash_in), the former /transfert endpoint is no longer served. The calls below are unchanged; the package translates them.

Configuration

# Login and password of the Dohone account (the ones of the Dohone web site)
DOHONE_API_USERNAME=
DOHONE_API_PASSWORD=
# Hashing code of the account (profile page) = config 'payOutHashCode', checks the notifications.
# Not needed when your published config/dohone.php already sets payOutHashCode.
DOHONE_MERCHANT_HASH=
# Optional
DOHONE_API_URL=          # default: sandbox or live API Exchange according to DOHONE_SANDBOX
DOHONE_API_TIMEOUT=100

The access token is cached (Laravel cache) for its validity.

1. Make payout to mobile phone

use Dohone\Gateway\Operator;

$response = DohonePayOut::mobile()
        ->setAmount(10000)                       // XAF, no decimals
        ->setMethod(Operator::ORANGE)            // or the former DohonePayOut::ORANGE (6) / DohonePayOut::MTN (5)
        ->setReceiverAccount('237699442200')
        ->setReceiverName("Firstname Lastname")
        ->setTransactionID($yourUniqueReference) // 30 characters at most, a UUID is encoded on 28
        ->setNotifyUrl('https://your.site/dohone/payout')
        ->setDescription('Withdrawal')
        ->post();

if ($response->isAccepted()) {
    // the receiver has the money, Dohone reference: $response->getReference()
} elseif ($response->isPending()) {
    // PENDING (or UNKNOWN after a timeout): wait for the notification
} else {
    // refused: $response->getMessage(), $response->getErrors()
}

isSuccess() is true for ACCEPTED, PENDING and UNKNOWN (Dohone took the request), and getMessage() ends with / {reference}.

2. Payout notification

Dohone calls the notifyUrl (GET) with transID, amount, currency, refTrans, status (SUCCESS or CANCELED), destination, mode, Hash...

use Dohone\Gateway\Notification;

if (!Notification::verifyPayOut($request->all())) {   // MD5(refTrans + transID + amount + hashing code)
    abort(403);
}
$transactionId = Notification::payOutTransactionId($request->all()); // decoded back to your UUID
$status = Notification::payOutStatus($request->all());               // SUCCESS | CANCELED

Notification::verifyPayIn() checks the pay-in notification (MD5(idReqDoh + rI + rMt + hashing code)).

Response object method return by each

Method Description
isSuccess() Is true when there is no error
getMessage() Content a description of the response
shouldVerifySMS() Return true if a SMS has been send to user for confirmation. Use this method to allow user to enter the code
getPaymentUrl() This method return the link generate by DohonePayOut::payWithUI()
getErrors() Get all errors catch during execution such as data validation
getState() Payout: ACCEPTED, PENDING, REJECTED or UNKNOWN (timeout)
isAccepted() / isPending() Payout: money received / final status to come with the notification
getReference() / getOperatorReference() Payout: Dohone reference (acquirertrxref) / operator reference
getBody() Payout: decoded answer of Dohone