API PUSH

  OBLIGATOIRE


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 withdraw your customers in several ways, namely by ORANGE MONEY PURSE, CASHPOINT-WARI and by the account PayDunya. For this you will need three 03 keys in the format JSON .


The three 03 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"; " wari " for "cashpoints"

 Note



For "PayDunya account", you simply must not use the key JSON "withdraw_mode".

 IMPORTANT



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

1 - ORANGE MONEY SENEGAL CASE


Endpoints API

https://app.paydunya.com/api/v1/direct-pay/credit-account

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" }' \ 
"https://app.paydunya.com/api/v1/direct-pay/credit-account " 

 Note



“account_alias” and “amount” are mandatory. If you do not use “withdraw_mode” the withdrawal will be made to the PayDunya customer account. “amount” must not be a decimal value and the supported currency is XOF, “account_alias” must be a phone number without a country code.


Expected response


{ 
    "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" 
} 

  Note


"transaction_id" is the PayDunya transaction ID, "provider_ref" the transaction reference for the provider.

2 - FREE-MONEY CASE


Endpoints API

https://app.paydunya.com/api/v1/direct-pay/credit-account

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" : "765962914", "amount" : 4500, "withdraw_mode" : 
"free-money-senegal" }' \ 
"https://app.paydunya.com/api/v1/direct-pay/credit-account " 

 Note



“account_alias” and “amount” are mandatory. If you do not use “withdraw_mode” the withdrawal will be made to the PayDunya customer account. “amount” must not be a decimal value and the supported currency is XOF, “account_alias” must be a phone number without a country code.


Expected response


{ 
    "response_code": "00", 
    "response_text": "Transaction completed successfully"", 
    "description": "Success! Amount of 4500 FCFA has been transfered to Free-Money Account 765962914", 
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97", 
    "provider_ref": "CI191223.1739.AC185" 
} 

  Note


"transaction_id" is the PayDunya transaction ID, "provider_ref" the transaction reference for the provider.

3 - E-MONEY CASE


Endpoints API

https://app.paydunya.com/api/v1/direct-pay/credit-account

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" : "705962914", "amount" : 4500, "withdraw_mode" : 
"expresso-senegal" }' \ 
"https://app.paydunya.com/api/v1/direct-pay/credit-account "

 Note



“account_alias” and “amount” are mandatory. If you do not use “withdraw_mode” the withdrawal will be made to the PayDunya customer account. “amount” must not be a decimal value and the supported currency is XOF, “account_alias” must be a phone number without a country code.


Expected response


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

  Note


"transaction_id" is the PayDunya transaction ID, "provider_ref" the transaction reference for the provider.

4 - WARI CASE


4-1 - Generate the withdrawal code


If you use "wari" as "withdraw_mode", you must fill in an additional json node:

  • "receiver_data" a (02)  child nodes: "first-name" and "last_name".

  • "sender_data" a (03)  child nodes: "first-name" , "last_name" and "phone_number". The "phone_number" is the phone number with the country code (for example 22177888965).


Endpoints API

https://app.paydunya.com/api/v1/direct-pay/credit-account

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" : "wari",
"receiver_data": {
              "first_name":"Christopher",
              "last_name":"Jean"
},
"sender_data": {
            "first_name":"Aziz",
            "last_name":"Mamadou",
            "phone_number":"221774441046"
  }
}' \
"https://app.paydunya.com/api/v1/direct-pay/credit-account "

Expected response


{ 
    "response_code": "00", 
    "response_text": "Transaction completed successfully", 
    "description": " Success! Wari withdrawal code corresponding to an amount of 4500 FCFA has been transfered to Christopher Jean. Phone number: 771111111", 
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97", 
    "provider_ref": "956548654", 
    "provider_tx_id": "545665445" 
} 

 Note


"transaction_id" is the PayDunya transaction ID. In the case of an ATM, "provider_ref" is the withdrawal code (ie the withdrawal code sent to the client). "provider_tx_id" is the transaction ID of the provider.

 Note


It is "provider_tx_id" which is used to check the status of the withdrawal code.


4-2 - Get the status of the withdrawal code


You must provide "provider_tx_id" generated after creating the pickup code. The supplier name is "wari" .


Endpoints API

https://app.paydunya.com/api/v1/direct-pay/check-disburse-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 ' { 
    "provider" : "wari", 
    "provider_tx_id" : "545665445" 
}' \ 
" http://paydunya.core/api/v1/direct-pay/check-disburse-status " 

Expected response


{ 
    "response_code": "00", 
    "response_text": "success", 
    "withdrawal_data": {
        "status": "payed",
        "message": "Transaction status is payed", 
        "payed_date": "2019/04/19 11:57:14"
    }
} 

 Note


"response_code" to 00 means that the request was successful. “withdrawal_data” the node will provide you with the final withdrawal with a child node “Status”. The different statuses are "paid", pending and cancel. You also have payed_date for the withdrawal date.


4-3 - Cancel the cash register code


You must provide "provider_tx_id" and “transaction_id” generated after the creation of the collection code. The supplier name is "wari".


Endpoints API

https://app.paydunya.com/api/v1/direct-pay/refund-disburse

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 ' { 
    "provider" : "wari", 
    "provider_tx_id" : "545665445", 
    "transaction_id": "TFA-TX-xx9qRr5rsYRCZTYXhBry" 
}' \ 
" http://paydunya.core/api/v1/direct-pay/refund-disburse " 

Expected response


{ 
   "response_code": "00", 
    "response_text": "success", 
    "refund_data": {
        "code_pickup_amount": 200,
        "refund_amount": 203
    }
} 

 Note


"response_code" to 00 means that the request was successful. "refund_amount" for the refund of the amount on your PayDunya account.


4-4 - Update disbursement


You must provide "provider_tx_id" and “transaction_id” generated after the creation of the collection code. The supplier name is "wari".


Endpoints API

https://app.paydunya.com/api/v1/direct-pay/update-disburse

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 '{  
    "provider": "wari", 
    "provider_tx_id": "545665445", 
    "transaction_id": "TFA-TX-xx9qRr5rsYRCZTYXhBry", 

    "receiver_data": { 
        "first_name":"Esther", 
        "last_name":"Goyette" 
    }, 

    "sender_data": { 
        "first_name":"Hector", 
        "last_name":"Salvador", 
        "phone_number":"221771911477" 
    } 
}'  
"http://paydunya.core/api/v1/direct-pay/update-disburse" 

Expected response


{ 
    "response_code": "00",
    "response_text": "success", 
    "response_data": {
        "date": "2019/04/19 11:57:14"
    }
} 

 Note


"response_code" to 00 means that the request was successful. "response_data" is the update date.

5 - Phone credit topup


Endpoints API

https://app.paydunya.com/api/v1/direct-pay/credit-account

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" : "777969818", "amount" : 4500, "withdraw_mode" : 
"airtime" , "operator" : "ORANGE" }' \ 
"https://app.paydunya.com/api/v1/direct-pay/credit-account" 

Note


“operator” maybe evening :

  • “ORANGE”
  • “TIGO”
  • “EXPRESSO”

 Note



“account_alias” and “amount” are mandatory. If you do not use “withdraw_mode” the withdrawal will be made to the PayDunya customer account. “amount” must not be a decimal value and the supported currency is XOF, “account_alias” must be a phone number without a country code.


Expected response


{ 
    "response_code": "00", 
    "response_text": "Transaction completed successfully"", 
    "description": "Success! Amount of 4500 FCFA has been transfered to Phone Number 777969818", 
    "transaction_id": "TFA-TX-37XqPpVCjU7ReiycUg97", 
    "provider_ref": "565486" 
} 

  Note


"transaction_id" is the PayDunya transaction ID, "provider_ref" the transaction reference for the provider.

6 - Response codes


  • 1001

    Withdrawal mode not supported


    
    {
        "response_code": "1001", 
        "response_text": 
        " Withdrawal mode not supported!"   
    }
    
    
  • 4002

    Not enough funds in the PayDunya sender's account


    
    {
        "response_code": "4002", 
        "response_text": " You don't have enough funds. Consider crediting your account", 
    }
    
    
  • 4003

    The minimum amount is greater than the amount to be withdrawn


    
    {
        "response_code": "4003", 
        "response_text": " Deposit failed! The amount must be greater than 200 FCFA." 
    }