Skip to content

Quickstart

This guide takes you from credentials to a completed mobile money collection. The examples use the pre-production base URL, https://preprod.api.nerasika.com.

  1. Get your credentials

    When your merchant account is created, Nerasol emails you a merchant ID and a merchant secret. Keep the secret on your server only.

  2. Generate an access token

    Send your merchant ID in the body and your secret in the x-merchant-secret header.

    Terminal window
    curl -X POST https://preprod.api.nerasika.com/api/v1/transactions/auth/token \
    -H "Content-Type: application/json" \
    -H "x-merchant-secret: $NERASIKA_SECRET" \
    -d '{ "merchantId": "'"$NERASIKA_MERCHANT_ID"'" }'

    The response holds the token in data.token. It is valid for 24 hours, so cache it.

  3. Request a payment

    Send the customer’s number, the amount and your callback URL.

    Terminal window
    curl -X POST https://preprod.api.nerasika.com/api/v1/transactions/payments/collection \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $TOKEN" \
    -d '{
    "phone": "0241234567",
    "amount": "10.50",
    "desc": "Order 1042",
    "network": "MTN",
    "merchantRef": "order-1042",
    "merchantCallbackURL": "https://example.com/callback"
    }'

    NeraSika replies 202 Accepted:

    {
    "success": true,
    "message": "Transaction processing",
    "data": {
    "transactionId": "6718a2c4e5f0a1b2c3d4e5f6",
    "merchantRef": "order-1042",
    "amount": 10.5,
    "status": "pending"
    }
    }

    The customer now sees a prompt on their phone to approve the payment.

  4. Receive the result

    When the customer approves or declines, NeraSika sends a POST to your callback URL:

    {
    "transactionId": "6718a2c4e5f0a1b2c3d4e5f6",
    "merchantRef": "order-1042",
    "transactionType": "collection",
    "amount": 10.5,
    "isoCode": "000",
    "code": "111",
    "status": "successful",
    "statusReason": "successful"
    }

    Reply with any 2xx status. If status is successful (isoCode 000), fulfil the order.