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

  1. You create a collection with method omitted or mobile_money, amount and customer's phone number
  2. System detects the mobile money provider (MTN/Airtel)
  3. Customer receives a USSD prompt or SMS notification
  4. Customer approves or declines; you receive a webhook/callback with the result

Card payments flow

  1. You create a collection with method = card, amount, country and reference (no phone number)
  2. API returns redirect_url (e.g. https://wallet.wearemarz.com/pay/card-gateway?reference=...)
  3. You send the customer to redirect_url (open in browser or redirect)
  4. 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

POST /collect-money Create a collection
GET /collect-money/services Get available services
GET /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 for method=card
  • country - Country code (UG)
  • reference - REQUIRED UUID format reference (e.g., 123e4567-e89b-12d3-a456-426614174000)

Optional Fields

  • method - mobile_money (default) or card. Use card for card collections
  • description - 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
Valid UUID Examples:
c97fae8b-9b7f-4192-9f72-6f0859d33e67
123e4567-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 reference for each collection
  • Use the redirect_url from 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 method to mobile_money or omit; include phone_number

Airtel Money

  • 0700-0750
  • Set method to mobile_money or omit; include phone_number

Card payments

  • Card Payments
  • Set method to card; omit phone_number; use redirect_url from 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
Chat on WhatsApp