API PUSH

  MANDATORY


After having followed the steps found in the section introduction, you can then integrate this API Client.


INTRODUCTION


To make a withdrawal you needed your API keys in your PayDunya account. So log into your PayDunya account already created and access your API keys by the link details just to the right of the app you created.


So you can make disbursements to your customers in several ways, namely through ORANGE MONEY PURSE, the PayDunya account and many others. For this you will need four 04 keys in the format JSON .


The four 04 JSON keys to have are as follows :

  • "account_alias" :

    Is the recipient's phone number without a country code.

  • "amount"

    Is the amount to be spent inXOF

  • "withdraw_mode"

    Defines the withdrawal endpoint: "orange-money-senegal" for "Orange Money wallet".

  • "callback_url"

    This is the URL where the transaction details will be returned once the transaction is successful. "The URL must be a Valid URL otherwise the transaction will not be authorized"

IMPORTANT



Make sure that the PER API or disbursement is activated in your dashboard at API WebPay and MobPay level. your dashboard

The different possible statuses


Intermediate statuses :

  • Created : This status is returned to mean that the disbursement request has been created by PayDunya but not yet sent to the operator for execution.

  • Pending : This status means that the token has been submitted to the operator for execution, but the transaction is still being processed. To check the final status of the transaction, please use the Check Statut.

Statuts finaux :

  • Success : This status indicates that the transaction was successful.

  • Failed : This status indicates that the transaction was not successful.


1 - Initiate Disbursement

Note


  • account_alias : is the receiver phone number without country code.

  • amount : is the amount to disburse in XOF.

  • withdraw_mode : with have different types of withdraw mode mentioned below :

    • paydunya : for account to account

    • orange-money-senegal : for orange money Sénégal wallet

    • free-money-senegal : for free money Sénégal wallet.

    • expresso-senegal : for e-money Sénégal wallet.

    • wave-senegal : for wave Sénégal wallet.

    • mtn-benin : for mtn Bénin wallet.

    • moov-benin : for Moov Bénin wallet.

    • mtn-ci : for mtn Ivory Coast wallet.

    • orange-money-ci : for Orange Money Ivory Coast wallet.

    • moov-ci : for moov Ivory Coast wallet.

    • wave-ci : for wave Ivory Coast wallet.

    • t-money-togo : for T-Money Togo wallet.

    • moov-togo : for Moov Togo wallet.

    • orange-money-mali : for Orange Money Mali wallet.

    • orange-money-burkina : for Orange Money Burkina wallet.

    • moov-burkina-faso : for Moov Burkina wallet.

  • callback_url : This is the URL where the transaction details will be returned once the transaction is successful. The URL must be a Valid URL otherwise the transaction will not be authorized


Example of information received on the callback :

{
    "status":"success",
    "token":"xZsV7x488d2yGCrJd2R ",
    "withdraw_mode":"orange-money-senegal",
    "amount":"203.00",
    "updated_at":"11/01/2024 14:30:32",
    "disburse_id": "78112205445565",
    "transaction_id":"TFA-TX-N458MPjhA1npWbI6M",
    "disburse_tx_id":"CI000111.1430.A11197"
}

 Note



The disburse_id will only appear if the merchant provides it when submitting invoice.

Endpoints API

https://app.paydunya.com/api/v2/disburse/get-invoice

Request POST HTTP


curl -H "Content-Type: application/json" \ 
-H "PAYDUNYA-MASTER-KEY: wQzk9ZwR-Qq9m-0hD0-zpud-je5coGC3FHKW" \ 
-H "PAYDUNYA-PRIVATE-KEY: test_private_rMIdJM3PLLhLjyArx9tF3VURAF5" \ 
-H "PAYDUNYA-TOKEN: IivOiOxGJuWhc5znlIiK" \ 
-X POST -d ' { "account_alias" : "771111111", "amount" : 4500, "withdraw_mode" : 
"orange-money-senegal", "callback_url": "your_callback_url" }' \ 
"https://app.paydunya.com/api/v2/disburse/get-invoice" 

 Note



“account_alias”, “amount” and “callback_url” are mandatory. For Free money and E money Wallet just change with the corresponding “withdraw_mode” value. “amount” must not be a decimal value and the supported currency is XOF, “account_alias” must be a phone number without a country code.


Note


When a token is generated (at the initiation of the disbursement), the status of the transaction is « created ». This status is specifically returned to mean that you have created a disbursement request but it has not yet been submitted. The status only changes if you push via the Submit Invoice API, after which the three possible statuses are:pending, success, failed.


Expected response


{ 
    "response_code": "00",
    "disburse_token": "hwTHAS0WvTmTaYT2zDoO"
} 

1-2 - PAYDUNYA CASE


Endpoints API

https://app.paydunya.com/api/v2/disburse/get-invoice

Request POST HTTP


curl -H "Content-Type: application/json" \
-H "PAYDUNYA-MASTER-KEY: wQzk9ZwR-Qq9m-0hD0-zpud-je5coGC3FHKW" \
-H "PAYDUNYA-PRIVATE-KEY: test_private_KEY: test_private_rMIdJM3PLLhLjyArx9tF3VURAF5" \
-H "PAYDUNYA-TOKEN: IivOiOxGJuWhc5znlIiK" \
-X POST -d '{"account_alias" : "771111111", "amount" : 4500, "withdraw_mode" : 
"paydunya", "callback_url": "your_callback_url"}' \
"https://app.paydunya.com/api/v2/disburse/get-invoice"

Expected response


{ 
    "response_code": "00",
    "disburse_token": "hwTHAS0WvTmTaYT2zDoO"
} 

2 - SUBMIT DISBURSEMENT

Note


disburse_id is your own transaction reference number, it is optional. If you don’t have this just post the request with only disburse_invoice (required) as input parameter.


Détails


  • The different status :

    • success
    • pending
    • failed

Endpoints API

https://app.paydunya.com/api/v2/disburse/submit-invoice

Request POST HTTP


curl -H "Content-Type: application/json" \ 
-H "PAYDUNYA-MASTER-KEY: wQzk9ZwR-Qq9m-0hD0-zpud-je5coGC3FHKW" \ 
-H "PAYDUNYA-PRIVATE-KEY: test_private_rMIdJM3PLLhLjyArx9tF3VURAF5" \ 
-H "PAYDUNYA-TOKEN: IivOiOxGJuWhc5znlIiK" \ 
-X POST -d ' {"disburse_invoice": "hwTHAS0WvTmTaYT2zDoO ", " disburse_id ": "456678900309" }' \ 
"https://app.paydunya.com/api/v2/disburse/submit-invoice"

Expected response For PayDunya


{ 
    "response_code": "00",
    "response_text": "Transaction completed successfully",
    "description": " Success! Amount of 200.00 FCFA has been transfered to to Christopher Jean Account 707006948",
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97"
} 


Expected response For Orange Money


{ 
    "response_code": "00",
    "response_text": "Transaction completed successfully",
    "description": "Success! Amount of 4500 FCFA has been transfered to Orange Money Account 771111111",
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97", 
    "provider_ref": "565486545315"
} 


Expected response For Free Money


{ 
    "response_code": "00",
    "response_text": "Transaction completed successfully",
    "description": "Success! Amount of 4500 FCFA has been transfered to Free-Money Account 761111111",
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97", 
    "provider_ref": "565486545315"
}
OR
{ 
    "response_code": "00",
    "status": "pending",
    "response_text": "Transaction pending",
    "description": "Transaction pending, please check the final status later through our status API",
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97"
}  

Expected response For E MONEY SENEGAL


{ 
    "response_code": "00", 
    "response_text": "Transaction completed successfully"", 
    "description": "Success! Amount of 4500 FCFA has been transfered to E Money Account 0588118811", 
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97", 
    "provider_ref": "565486545315" 
} 


Expected response For WAVE SENEGAL


{
    "response_code": "00",
    "response_text": "Transaction completed successfully",
    "description": "Success! Amount of 4500 FCFA has been transfered to Wave Account 777777777",
    "transaction_id": "TFA-TX-0sks0bagCMQkZ0SG91nc",
    "provider_ref": "pt-67Ggh7zgm013syghghjkhgjh"
}


Expected response For MTN MOMO BENIN


{ 
    "response_code": "00", 
    "response_text": "Transaction completed successfully"", 
    "description": "Success! Amount of 4500 FCFA has been transfered to Mtn Money Account 0588118811", 
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97", 
    "provider_ref": "565486545315" 
} 


Expected response For Moov Bénin


{
    "response_code": "00",
    "response_text": "Transaction completed successfully",
    "description": "Success! Amount of 200.00 FCFA has been transfered to MOOV BJ Account 95920904",
    "transaction_id": "TFA-TX-E36T8kfja2cpR00CKuVq",
    "provider_ref": "920230224297772"
}

Expected response For MTN MOMO IVORY COAST


{ 
    "response_code": "00", 
    "response_text": "Transaction completed successfully"", 
    "description": "Success! Amount of 4500 FCFA has been transfered to Mtn Money Account 0588118811", 
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97", 
    "provider_ref": "565486545315" 
} 


Expected response For Orange Money IVORY COAST


{ 
    "response_code": "00",
    "response_text": "Transaction completed successfully",
    "description": "Success! Amount of 4500 FCFA has been transfered to Orange Money CI Account 771111111",
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97", 
    "provider_ref": "565486545315"
} 


Expected response For Moov IVORY COAST


{ 
    "response_code": "00",
    "response_text": "Transaction completed successfully",
    "description": "Success! Amount of 4500 FCFA has been transfered to Moov CI Account 771111111",
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97", 
    "provider_ref": "565486545315"
} 


Expected response For WAVE IVORY COAST


{
    "response_code": "00",
    "response_text": "Transaction completed successfully",
    "description": "Success! Amount of 4500 FCFA has been transfered to Wave Account 777777777",
    "transaction_id": "TFA-TX-0sks0bagCMQkZ0SG91nc",
    "provider_ref": "pt-67Ggh7zgm013syghghjkhgjh"
}


Expected response For T-Money Togo


{ 
    "response_code": "00",
    "response_text": "Transaction completed successfully",
    "description": "Success! Amount of 4500 FCFA has been transfered to T-money Account 771111111",
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97", 
    "provider_ref": "565486545315"
} 


Expected response For Moov Togo


{ 
    "response_code": "00",
    "response_text": "Transaction completed successfully",
    "description": "Success! Amount of 4500 FCFA has been transfered to MOOV-TOGO Account 98010101",
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97", 
    "provider_ref": "24020605401685281675"
} 


Expected response For Orange Money Mali


{
    "response_code": "00",
    "status": "pending",
    "response_text": "Transaction pending",
    "description": "Transaction pending, please check the final status later through our status API",
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97"
}

Expected SUCCESS RESPONSE For Orange Money Burkina


{
    "response_code": "00",
    "response_text": "Transaction completed successfully",
    "description": "Success! Amount of 200 FCFA has been transfered to   Orange Money Burkina 66123421",
    "transaction_id": "TFA-TX-37XqPpjCjU7ReiycUg97", 
    "provider_ref": "565486545315"
}

Expected PENDING RESPONSE For Orange Money Burkina


{
    "response_code": "00",
    "status": "pending",
    "response_text": "Transaction pending",
    "description": "Transaction pending, please check the final status later through our status API",
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97"
}

Expected RESPONSE For Moov Burkina


{
    "response_code": "00",
    "status": "success",
    "response_text": "Transaction completed successfully",
    "description": "Success! Amount of 200.00 FCFA has been transfered to MOOV-BURKINA-FASO Account 03111111",
    "transaction_id": "TFA-TX-J9ARQ1auOEjWxbeERi5J",
    "provider_ref": "WCASH240902.0916.B00316"
}

3 - CHECK DISBURSE STATUS


Endpoints API

https://app.paydunya.com/api/v2/disburse/check-status

Request POST HTTP


curl -H "Content-Type: application/json" \ 
-H "PAYDUNYA-MASTER-KEY: wQzk9ZwR-Qq9m-0hD0-zpud-je5coGC3FHKW" \ 
-H "PAYDUNYA-PRIVATE-KEY: test_private_rMIdJM3PLLhLjyArx9tF3VURAF5" \ 
-H "PAYDUNYA-TOKEN: IivOiOxGJuWhc5znlIiK" \ 
-X POST -d ' {"disburse_invoice": "hwTHAS0WvTmTaYT2zDoO"}' \ 
"https://app.paydunya.com/api/v2/disburse/check-status"

EXPECTED RESPONSE


{ 
    "response_code": "00",
    "status": "success",
    "token": " xZsV7x488d2yGCrJd2R ",
    "withdraw_mode": "orange-money-senegal", 
    "amount": "203.00",
    "updated_at": "11/01/2024 14:30:35", 
    "disburse_id": "78112205445565",
    "transaction_id": "TFA-TX-NiP89775sdXKA1npWbI6M", 
    "disburse_tx_id": " CI000111.1430.A11197"
} 

 Note



The disburse_id will only appear if the merchant provides it when submitting invoice.

Détails



4 - ERROR CODES


  • HTTP Status 400

    response in case of data validation errors sent via an API


    
    {
        "response_code": ['1001', '5000'], 
        "response_text": text  
    }
    
    
  • 1001

    withdraw_mode non pris en charge.

  • 5000

    Service en maintenance, veuillez réessayer plus tard.


  • HTTP Status 200

    -GET INVOICE

    
    {
        "response_code": ['401', '4002', '5000'], 
        "response_text": text  
    }
    
    
  • 401

    -Initiation not authorize

  • 4002

    -You don't have enough funds. Consider crediting your account

    -the callback is not accessible

  • 5000

    -An error occured from our side. Please retry later.

    -disburse_id already used.


    IMPORTANT


    When submitting a disbursement request, you may receive a response code other than 00 or an error code. If this happens, you will need to check the status of the transaction with the Check Statut API using the token from the same transaction. If the transaction status is:

    • CREATED : you must start Submit again with the same token of the transaction.

    • PENDING : you must wait until the final status.

    • SUCCESS : you can close the transaction.

    • FAILED : you can close the transaction and inform your customer or start a new transaction since the creation of the token.