Collections Guide
Learn how to collect payments from customers using mobile money or card payments with
Overview
Collections allow you to request payments from customers via mobile money (MTN, Airtel) or card payments. For mobile money, the system detects the provider from the phone number and initiates the collection. For card, you receive a redirect_url and send the customer there to complete payment on the card gateway.
Mobile money flow
- You create a collection with
methodomitted ormobile_money, amount and customer's phone number - System detects the mobile money provider (MTN/Airtel)
- Customer receives a USSD prompt or SMS notification
- Customer approves or declines; you receive a webhook/callback with the result
Card payments flow
- You create a collection with
method=card, amount, country and reference (no phone number) - API returns
redirect_url(e.g.https://wallet.wearemarz.com/pay/card-gateway?reference=...) - You send the customer to
redirect_url(open in browser or redirect) - Customer completes payment on the card gateway; you receive callback/webhook with the result
API Base URL
All collections API requests should be made to the following base URL:
https://wallet.wearemarz.com/api/v1
API Endpoints
/collect-money
Create a collection
/collect-money/services
Get available services
/collect-money/{uuid}
Get collection details
Create Collection
To create a collection, send a POST request to the collection endpoint with the required parameters.
Request Parameters
Required Fields
amount- Amount in UGX (500 - 10,000,000)phone_number- Phone with country code (+256xxxxxxxxx). Required for mobile money; omit formethod=cardcountry- Country code (UG)reference- REQUIRED UUID format reference (e.g., 123e4567-e89b-12d3-a456-426614174000)
Optional Fields
method-mobile_money(default) orcard. Usecardfor card collectionsdescription- Payment description (max 255 chars)callback_url- Webhook/callback URL (max 255 chars)
Reference Requirements
API Collections require a valid UUID reference:
- Must be in UUID v4 format:
xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx - Must be unique across all API collections
- Cannot be reused - each collection needs a unique reference
- Maximum 50 characters
c97fae8b-9b7f-4192-9f72-6f0859d33e67123e4567-e89b-12d3-a456-426614174000
Example Request
curl --location 'https://wallet.wearemarz.com/api/v1/collect-money' \
--header 'Authorization: Basic YOUR_API_CREDENTIALS' \
--form 'phone_number="+256700000000"' \
--form 'amount="1000"' \
--form 'country="UG"' \
--form 'reference="123e4567-e89b-12d3-a456-426614174000"' \
--form 'description="Payment for services"' \
--form 'callback_url="https://your-app.com/webhook"'
Example Response
{
"status": "success",
"message": "Collection initiated successfully.",
"data": {
"transaction": {
"uuid": "4e7fb3fa-c13a-4b05-8acd-cf60ff68cb94",
"reference": "COL1703123456789abc",
"status": "processing",
"provider_reference": null
},
"collection": {
"amount": {
"formatted": "1,000.00",
"raw": 1000,
"currency": "UGX"
},
"provider": "mtn",
"phone_number": "+256781230949",
"mode": "live"
},
"timeline": {
"initiated_at": "2024-01-20 14:30:00",
"estimated_settlement": "2024-01-20 14:35:00"
}
}
}
Card payments
To collect via card, send method = card. phone_number is not required. The API returns a redirect_url; send the customer to that URL (e.g. open in browser or redirect). They will complete payment on the card gateway, then be returned to your callback_url or the default return page.
Requirements
- Your business must have an active Card Payments subscription for the country (e.g. UG or GLOBAL)
- Use a unique UUID
referencefor each collection - Use the
redirect_urlfrom the response as-is; do not add extra path segments or slashes
Example request (card)
curl -X POST 'https://wallet.wearemarz.com/api/v1/collect-money' \
-H 'Authorization: Basic YOUR_BASE64_API_CREDENTIALS' \
-H 'Content-Type: application/json' \
-d '{
"amount": 5000,
"method": "card",
"reference": "123e4567-e89b-12d3-a456-426614174000",
"country": "UG",
"description": "Order payment"
}'
Example response (card)
{
"status": "success",
"message": "Card collection initiated. Redirect the customer to redirect_url.",
"data": {
"transaction": {
"uuid": "a799c628-f52a-4540-8b77-43509f2775d3",
"reference": "b59d3d6d-5827-41ee-b455-18dd20ef1c8a",
"status": "pending"
},
"redirect_url": "https://wallet.wearemarz.com/pay/card-gateway?reference=b59d3d6d-5827-41ee-b455-18dd20ef1c8a"
}
}
Send the customer to data.redirect_url (e.g. open in same tab, new tab, or redirect). After payment they are sent to your callback_url or the default return page. Use webhooks or the transaction status API to confirm completion.
Provider Detection
The system automatically detects the mobile money provider based on the phone number pattern.
Supported collection methods
MTN Mobile Money
- 0760-0780, 077, 078, 031, 039
- Set
methodtomobile_moneyor omit; includephone_number
Airtel Money
- 0700-0750
- Set
methodtomobile_moneyor omit; includephone_number
Card payments
- Card Payments
- Set
methodtocard; omitphone_number; useredirect_urlfrom response
Sandbox Mode
New accounts start in sandbox mode where you can test all collection features without processing real payments or creating actual transactions.
Sandbox Features
- No actual mobile money API calls are made
- No real transactions are created in the database
- Immediate dummy success response
- Generated sandbox provider references
- Status set to "sandbox"
- Perfect for development and testing
Webhooks & Callbacks
You can receive real-time notifications about collection status through webhooks or custom callback URLs.
Notification Methods
- Custom Callback URL: Per-transaction callback URL for immediate notifications
- Webhooks: Global webhook configuration for all transactions
- Status Updates: Real-time status changes (pending, processing, successful, failed)
Best Practices
Phone Number Format
- Always include country code (+256 for Uganda)
- Use the format: +256xxxxxxxxx
- Ensure the number is active and registered for mobile money
Amount Limits
- Minimum amount: 500 UGX
- Maximum amount: 10,000,000 UGX
- Consider customer's mobile money limits
Error Handling
- Always check the response status
- Handle failed collections gracefully
- Implement retry logic for failed requests
- Monitor webhook delivery and implement fallbacks