Payment Request API

  OBLIGATOIRE


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


DEFINITION


PayDunya's "Payment Request (DMP)" API allows you to easily send your invoices by SMS / Email to your customers or partners and receive payments instantly from anywhere in the world via a multitude of means of payment.

The customer receives an SMS or an Email, in which he will find a link on which to click to make the payment according to his preferred means of payment.

1 - Generating your API keys


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


API keys are three (3):

  • PAYDUNYA-MASTER-KEY: which is the main key of your application

  • PAYDUNYA-PRIVATE-KEY: which is the private key of your application in production mode

  • PAYDUNYA-TOKEN: which is the token of your application in production mode


Once the keys are generated, you can now use ourDMP API.


Endpoints API

https://app.paydunya.com/api/v1/dmp-api

POST Request 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 '{ "recipient_email": "[email protected]", "amount": 1250, "support_fees ": 1, "send_notification":1 }' \ 
"https://app.paydunya.com/api/v1/dmp-api" 

Note

  • recipient_email: this is the email address of the person who will receive the payment request.

  • recipient_phone: this is the phone number of the person who will receive the payment request.

  • amount:this is the amount of the payment request. It is between 200 and 3,000,000.

  • support_fees: it is a Boolean value

    • 0/code>: it means that it is your customers who will bear the costs.

    • 1: it means that it is you support the costs.

  • send_notification:it is a Boolean value

    • 1: it means that you have chosen the default option and that it is PayDunya which sends SMS and Emails to your customers.

    • 0: it means that the notification (SMS, Email) will not be sent. It is up to you to personalize your SMS and Emails to send to your customers.

Note


L'un des attributs recipient_phone or recipient_email are required in the request. But it is optional to submit both in the same request.


Expected response


{ 
    "success": true,
    "message": "Your payment request has been sent successfully."
} 

Note


Remember that for this option SMS and Emails are automatically sent by PayDunya.


EXPECTED RESPONSE IN THE CASE OF OPTION 0


{
    "response-code": "00",
    "reference_number": "4190239470044",
    "url": "https://pydu.me/k5Rrrj",
    "description": "Your payment request has been created successfully"
}

Note

  • response-code: this is the answer when the request is successful

  • reference_number: this is the reference number of the payment request. You can use it to personalize your messages.

  • url: c’Is the link to the payment page to put on your personalized messages (sms and email).

  • description: This is the message to display when the request is successful.

Note


In addition to the Payment Request Creation Endpoint, there is another one that allows you to check the status. This method takes as input the reference_number which was returned when the DMP was created and returns a response-code and status.


ENDPOINT TO CHECK STATUS

https://app.paydunya.com/api/v1/dmp-api/check-status


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 '{ "reference_number" : "4190239470044" }' \ 
"https://app.paydunya.com/api/v1/dmp-api/check-status" 

EXPECTED RESPONSE


{
    "response-code": "00",
    "status": "pending"
}

Note

  • response-code: is the code obtained on the response of the request its value is equal to "00" if the reference_number given as input has a payment request. Otherwise its value will be equal to "4004".

  • status: is the status of your payment request.

    • pending: if the payment request is pending payment.

    • completed: if the payment request has been paid.

    • failed: if the payment request has failed.

2 - Error Codes


  • 00

    Payment request created successfully.


    
    {
        "response-code": "00", 
        "message": "Payment request created successfully",
        "description": "Payment request created successfully"   
    }
    
    
  • 4000

    Your request was malformed.


    
    {
        "response-code": "4000", 
        "message": "Your request was malformed. MASTER_KEY PRIVATE_KEY or TOKEN is missing",
        "description": "MASTER_KEY, PRIVATE_KEY or TOKEN is missing"
    }
    
    
  • 4001

    Integration mode must be live


    
    {
        "response-code": "4001", 
        "message": "Integration mode must be live",
        "description": "Integration mode must be live"
    }
    
    
  • 1000

    Invalid keys


    
    {
        "response-code": "1000", 
        "message": "Invalid keys",
        "description": "Invalid keys"
    }
    
    
  • 4004

    Payment request not found


    
    {
        "response-code": "4004", 
        "message": "Payment request not found",
        "description": "Payment request not found"
    }