Payment

Sales request

Sale request API is used when you want a customer to pay you using Mobile Finance service such as TIGO cash, Airtel money and Mtn mobile money. this API shall be called with required information then the end user shall recieve a USSD push asking him to confirm the payment by entering his PIN.

Purchase request

To do a purchase request to a customer on behalf of the customer, You will need to call this method. If the API you are calling is in test mode, the supplied payment details won't actually affect wallets, though everything else will occur as if in live mode. Havanao will assume that the purchase request would have been done and it shall give you the proper response.

URL : https://api.havanao.com/api/sale/purchase

HTTP Method : POST

ARGUMENTS

note: Order of the parameters is not necessary, you may arrange them the way you wish, this won't affect the method call.

Parameter Description
customer This is the phone number of the customer who is paying. example : 250720001111,250784835303,250733934393
amount Amount (value) the customer is paying, this value must be numeric. example : 5000
payment_reference This is your payment reference, this can be your transaction id and same value shall be passed while looking for the status of the payment.

Sample request

The requets for this method is sent in the body of the request with Content-Type:application/json in the header. Please make sure this is a valid json otherwise this may not work.

    {
      "amount": "500",
      "customer": "250722120101",
      "transactionid": "1231412asdfsd",
      "comment": "Just a comment"
    }
    {
      "amount": "500",
      "customer": "25074835303",
      "transactionid": "1231412asdfsd",
      "comment": "Just a comment"
    }
    {
      "amount": "500",
      "customer": "250733934393",
      "transactionid": "1231412asdfsd",
      "comment": "Just a comment"
    }

Sample response

    {
      "code": 200,
      "status": "OK",
      "transactionid": "TXN5-78F8-50AD-A922",
      "transactionStatus": "REQUESTED",
      "description": "Payment has been initiated. Customer has to confirm the payment to proceed further."
    }

Sample error response

    {
      "code": 400,
      "status": "ERROR",
      "transactionid": "TXN5-78F9-0AA5-0699",
      "transactionStatus": "DECLINED",
      "description": "You have already used 12312312sd as transaction id. Please provide a non used transaction id."
    }

note: You shall send the provided transaction number in the request for checking the status of the purchase.

Purchase status

You need to send a purchase status request in order to find out what happened to the purchase request you sent previously. You will need to send a get request with the transaction id provided in the response of the purchase request, then Havanao shall give you the status of the purchase.

URL : https://api.havanao.com/api/sale/status

HTTP Method : POST

Available status

Status Description
APPROVED Transaction has been approved and the customer has been charged
DECLINED Transaction has not beeen successfully on the client side, due to various factors such as not enough balance or wrong PIN etc..
REQUESTED Transactions is being processed, we are waiting for the customer PIN so that we can process it.

Sample request

The requets for this method is sent in the url of the request as a GET method .

https://api.havanao.com/api/sale/status?transactionId=1231412asdfsd&api_token=wQHeHsIDu6telv8AOuZmi9P4quNLQ5qvKJevkbsd4DHZevSg8g7KgNvb2KJ5

Sample response

    {
      "code": 200,
      "status": "OK",
      "transactionid" : "TXN-29293-191821",
      "transactionStatus": "APPROVED"
    }

Sample response

    {
      "code": 400,
      "status": "ERROR",
      "transactionid": "1231412asdfsd",
      "transactionStatus": "UNKNOWN",
      "description": "Invalid transactionid passed in the request"
    }