Skip to main content

Create Collection

This endpoint initiates a payment collection request to a customer's mobile money account. The transaction will initially be in a PENDING state until the customer authorizes the payment, the request is declined, or it times out.

Endpoint

POST /collections/collect

Request Parameters

ParameterTypeRequiredDescription
phonestringYesThe phone number of the payer (must include country code)
amountnumberYesThe amount to collect (must be greater than 0)
externalIdstringNoYour system's reference ID for this transaction
payerMessagestringNoMessage displayed to the payer during authorization
payeeNotestringNoNote for your own records (not shown to payer)

Headers

HeaderValueRequiredDescription
AuthorizationBearer YOUR_API_KEYYesYour API authorization token
Content-Typeapplication/jsonYesThe format of the request body

Example Request

const createCollection = async () => {
try {
const response = await fetch(
"https://pay.computerstore.ug/api/v1/collections/collect",
{
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
phone: "+256706859041",
amount: 500,
externalId: "order-20250520-001",
payerMessage: "Payment for internet subscription",
payeeNote: "ZenFii Hotspot System",
}),
}
);

const data = await response.json();
console.log(data);
} catch (error) {
console.error("Error:", error);
}
};

Response Parameters

The response will include information about the created transaction:

ParameterTypeDescription
successbooleanIndicates if the request was processed successfully
messagestringHuman-readable description of the result
payloadobjectContains all the transaction details
statusCodenumberHTTP status code of the response

Payload Object

FieldTypeDescription
idstringUnique transaction identifier
balanceIdstringIdentifier for the merchant balance
amountnumberTransaction amount
currencystringCurrency code (currently only UGX supported)
payerstringPhone number of the customer
payeeNotestring or nullNote for merchant reference
providerstringPayment provider (AIRTEL_UG or MTN_UG)
externalIdstring or nullMerchant-provided reference ID
statusstringTransaction status (PENDING, SUCCESS, FAILED, ROLLED_BACK)
messagestring or nullAdditional information about the transaction status
payerMessagestring or nullMessage shown to the customer
payerNamestring or nullName of the customer if available
createdAtstringISO timestamp of when the transaction was created

Example Response

{
"success": true,
"message": "Request sent to provider",
"payload": {
"id": "e870f17f-090b-40d6-9eb0-a1d683591917",
"balanceId": "cm63k6vw50004sea47kkdv78s",
"amount": 500,
"currency": "UGX",
"payer": "+256706859041",
"payeeNote": "ZenFii Hotspot System",
"provider": "AIRTEL_UG",
"externalId": "order-20250520-001",
"status": "PENDING",
"message": "Request sent to provider",
"payerMessage": "Payment for internet subscription",
"payerName": "MUJUNI INNOCENT",
"createdAt": "2025-05-20T18:55:51.336Z"
},
"statusCode": 201
}

Status Codes

CodeDescription
201Request created successfully
400Bad request - check your parameters
401Unauthorized - check your API key
500Server error occurred

Notes

  • The phone number must include the country code (e.g., +256 for Uganda)
  • The transaction ID returned in the response should be stored for future reference
  • You can use the transaction ID to check the status of the payment using the Check Status endpoint
  • The customer will receive a prompt on their phone to authorize the payment
  • You will receive a webhook notification when the transaction status changes