Authentication
API Keys
All requests to the CSUL Pay API must be authenticated using API keys. These keys are used to identify your account and authorize your requests.
Generating API Keys
To generate an API key:
- Log in to your CSUL Pay Dashboard
- Navigate to API Settings
- Click on the "Generate API Key" button
- Copy and securely store your API key
Important: The API key will only be displayed once. If you lose it, you'll need to generate a new one. You can have multiple active API keys at the same time.
Using API Keys
Include your API key in the Authorization header of all requests using the Bearer token format:
Authorization: Bearer YOUR_API_KEY
Example request using cURL:
curl -X POST https://pay.computerstore.ug/api/v1/collections/collect \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone": "+256700000000",
"amount": 5000
}'
Webhook Configuration
Webhooks are used to notify your system about events such as successful payments, failed transactions, or timeouts. To configure your webhook URL:
- Go to the API Settings page
- Enter your webhook URL in the designated field
- Click "Save Changes"
Webhook Requests
When an event occurs, CSUL Pay will send a POST request to your webhook URL with information about the event. Your server should respond with a 200 OK status code to acknowledge receipt of the webhook.
Example webhook payload:
{
"event": "collection.success",
"data": {
"id": "e870f17f-090b-40d6-9eb0-a1d683591917",
"amount": 500,
"currency": "UGX",
"payer": "+256706859041",
"provider": "AIRTEL_UG",
"externalId": "order-20250520-001",
"status": "SUCCESS",
"createdAt": "2025-05-20T18:55:51.336Z"
}
}
Available event types:
collection.success: Payment was successfulcollection.failed: Payment failedcollection.timeout: Payment request timed out