Customers

Grant credit to a customer

POST/api/v1/customers/{id}/credit-grants

Adds credit to the customer, with an optional expiry. With appliesTo invoice (the default) the credit is in the balance as promotional and pays the customer's next invoices, fee included. With appliesTo usage the credit is in the balance as usage and pays only the usage of metered prices: every metered price, or only the ones you list in prices. Granted credit is never paid out as money. It can be used from effectiveAt, and when the expiry passes the part that was not used is taken away. The grant shows in the credit entries as granted. Send a unique Idempotency-Key. Repeating the request with the same key and body returns the original grant.

Authorization

bearerAuth
AuthorizationBearer <token>

An access token from POST /api/v1/oauth/token, sent as Authorization: Bearer <token>.

In: header

Path Parameters

id*string

The customer's ID.

Formatuuid

Header Parameters

Idempotency-Key*string

A unique key you choose for this request: 1 to 255 visible ASCII characters, no spaces. A UUID works well. Never put personal data in it. Send the same key again to retry safely.

FlexMalipo-Version?"2026-11-06"

The API version to use for this request, a date such as 2026-11-06. Without it the request uses your default version for the mode of your key. An unknown version answers 400 api_version_invalid.

Value in

  • "2026-11-06"

Request Body

application/json

Credit to grant to a customer.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api-malipo.flex.co.tz/api/v1/customers/497f6eca-6276-4993-bfeb-53cbbbba6f08/credit-grants" \  -H "Authorization: Bearer <token>" \  -H "Idempotency-Key: 5f1c1e0a-3b7e-4c8e-9d1a-2f6b8a4c7e11" \  -H "FlexMalipo-Version: 2026-11-06" \  -H "Content-Type: application/json" \  -d '{    "amount": 5000,    "currency": "TZS",    "reason": "Apology for the late invoice"  }'
{  "id": "3b0f6c1e-52d4-4f0a-8f43-1c2d9a7e6b10",  "customerId": "7d5c1a2e-9b3f-4c8a-a1d2-6e4f8b0c3d57",  "amount": 5000,  "currency": "TZS",  "reason": "Apology for the late invoice",  "expiresAt": "2019-08-24T14:15:22Z",  "createdAt": "2019-08-24T14:15:22Z",  "appliesTo": "invoice",  "prices": [    "9a3c5e7f-1b2d-4c6e-8f0a-2b4d6f8a0c1e"  ],  "priority": 50,  "category": "promotional",  "effectiveAt": "2019-08-24T14:15:22Z",  "metadata": {    "property1": "string",    "property2": "string"  },  "source": "merchant",  "subscriptionId": "d079718b-ff63-45dd-947b-4950c023750f"}