Skip to content

API Reference - Online Checkout

This enables you to create a checkout invoice by providing the necessary details for your Customer to make payment.

Payment can be via mobile money, debit/credit card, GHQR, or Hubtel wallet. After making a payment, your website is notified through a redirect, and your online system is also notified by a web callback.

Request Parameters

ParameterTypeRequirementDescription
totalAmountFloatMandatorySpecifies the total amount expected to be paid for the Items being purchased.
descriptionStringMandatoryDescribes to customers actions they can perform on the checkout page.
callbackUrlStringMandatoryThe callback URL registered to receive the final notification on the status of the payment.
returnUrlStringMandatoryThe merchant website URL where the customer should return after payment.
cancellationUrlStringMandatoryThe merchant website URL where the customer should return after cancellation.
clientReferenceStringMandatoryA unique string identifying the request. Useful for reference purposes. It cannot be empty but must have a maximum of 32 characters.
PayeeNameStringOptionalThis refers to the name of the Payee.
PayeeMobileNumberStringOptionalThis refers to the mobile number of the Payee.
PayeeEmailStringOptionalThis refers to the Email of the Payee.

Response Parameters

ParameterTypeDescription
checkoutUrlStringA payee should be redirected to this link to make payment.
checkoutIdStringUnique Hubtel reference for transaction.
clientReferenceStringThis is a unique string identifying the request. Same as what was parsed in the request.
checkoutDirectUrlStringA payee can make payment on the same page request was made from with this URL.

Sample Request

json
POST https://payproxyapi.hubtel.com/items/initiate
Host: test.hubtel.com
Accept: application/json
Content-Type: application/json
Authorization: Basic endjeOBiZHhza24=
Cache-Control: no-cache

{  
  "totalAmount": 100,
  "description": "Book Shop Checkout",
  "callbackUrl": "https://webhook.site/8b4bbd0a-5f98-4b3d-abbe-b9b49767f7d5",
  "returnUrl": "http://hubtel.com/online",
  "merchantAccountNumber": "11684",
  "cancellationUrl": "http://hubtel.com/online",
  "clientReference": "inv0012"
}

Sample Response

json
{
    "responseCode": "0000",
    "status": "Success",
    "data": {
        "checkoutUrl": "https://pay.hubtel.com/7569a11e8b784f21baa9443b3fce31ed",
        "checkoutId": "7569a11e8b784f21baa9443b3fce31ed",
        "clientReference": "inv0012",
        "message": "",
        "checkoutDirectUrl": "https://pay.hubtel.com/7569a11e8b784f21baa9443b3fce31ed/direct"
    }
}