ZAR Change Calculator

Explore alternatively via Swagger: /swagger

Enter an amount (e.g. 786.80) and get the minimum notes & coins. Smallest supported denomination is 10c.

API Documentation

Public endpoint for developers to calculate ZAR note & coin breakdowns.

Base URL

https://change-calculator-benj.azurewebsites.net/api

Endpoint

POST /change/calculate

Request

JSON body (amount in ZAR):

{
  "amount": 786.80
}

Response

Returns the minimum number of banknotes & coins:

{
  "R200": 3,
  "R100": 1,
  "R50": 1,
  "R20": 1,
  "R10": 1,
  "R5": 1,
  "R2": 0,
  "R1": 1,
  "50c": 1,
  "20c": 1,
  "10c": 1
}

HTTP Status Codes

Examples

cURL

curl -s -X POST \
  https://change-calculator-benj.azurewebsites.net/api/change/calculate \
  -H "Content-Type: application/json" \
  -d "{\"amount\":786.80}"

JavaScript (fetch)

await fetch("https://change-calculator-benj.azurewebsites.net/api/change/calculate", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ amount: 786.80 })
}).then(r => r.json());

.NET (HttpClient)

using var http = new HttpClient { BaseAddress = new Uri("https://change-calculator-benj.azurewebsites.net/api/") };
var res = await http.PostAsJsonAsync("change/calculate", new { amount = 786.80m });
var data = await res.Content.ReadFromJsonAsync<Dictionary<string,int>>();

Notes