Service fulfilment
Receive the paid order, deliver the service, report fulfilment to Hubtel within one hour, and check a transaction's status.
After a customer pays, Hubtel sends the order to your Service Fulfilment URL. Deliver the service, then tell Hubtel within one hour.
Before you start(3)
- Create one at business.hubtel.com
A Hubtel business with a merchant account
Business APIs work through your business's merchant account. If you don't have one yet, sign up and set it up first.
- Payment keys
API ID and API key
They identify you on every request. Send them using HTTP Basic authentication.
- Account IDs
Collection account number
This is where your customers' payments arrive. You'll add it to the request URL.
Don't have these yet? Start in the sandbox with your test keys while you set them up.
Fulfilment goes both ways: Hubtel sends the paid order to your Service Fulfilment URL, and after you deliver the service, you send a fulfilment callback to Hubtel.
Receive the paid order
After the customer pays, Hubtel POSTs the order to your Service Fulfilment URL:
{
"SessionId": "example-session",
"OrderId": "example-order",
"ExtraData": {},
"OrderInfo": {
"CustomerMobileNumber": "233249111411",
"CustomerEmail": null,
"CustomerName": "Ama Mensah",
"Status": "Paid",
"OrderDate": "2023-11-06T15:16:50.3581338+00:00",
"Currency": "GHS",
"BranchName": "Haatso",
"IsRecurring": false,
"RecurringInvoiceId": null,
"Subtotal": 151.5,
"Items": [{ "ItemId": "5b8945940e1247489e34e756d8fc2dbb", "Name": "Send Money", "Quantity": 1, "UnitPrice": 150.5 }],
"Payment": {
"PaymentType": "mobilemoney",
"AmountPaid": 151.5,
"AmountAfterCharges": 150.5,
"PaymentDate": "2023-11-06T15:16:50.3581338+00:00",
"PaymentDescription": "The MTN Mobile Money payment has been approved and processed successfully.",
"IsSuccessful": true
}
}
}Match SessionId and OrderId to your records, and make sure a repeated request can't deliver the service twice. These requests come from 52.50.116.54, 18.202.122.131 and 52.31.15.68.
Report fulfilment
Within one hour of receiving the order, deliver the service and POST the result to Hubtel:
curl https://gs-callback.hubtel.com:9055/callback -H "Content-Type: application/json" \
-d '{"SessionId":"example-session","OrderId":"example-order","ServiceStatus":"success","MetaData":null}'The endpoint takes no Authorization header and accepts requests only from your allowlisted server IP. See the reference.
Check a transaction's status
If you have no final payment result after 5 minutes, check the status. This is mandatory. Pass the SessionId as clientReference, and your collection account number in the path:
curl "https://api-txnstatus.hubtel.com/transactions/$HUBTEL_COLLECTION_ACCOUNT/status?clientReference=example-session" \
-u "$HUBTEL_API_ID:$HUBTEL_API_KEY"status | Meaning | Do |
|---|---|---|
Paid | The customer paid. | Deliver the service if you haven't, then report fulfilment. |
Unpaid | Not paid yet, or failed. | Don't create a new payment; check again later. |
Refunded | The payment was refunded. | Reverse delivery as your service requires. |
isFulfilled shows whether Hubtel has recorded fulfilment and can be null. Keep your own fulfilment record. You can also look up a transaction by hubtelTransactionId or networkTransactionId. The response fields are described in Reconciliation.