Your first points in two calls

Find or create a member by phone number, then add points for a bill. Use a test key, so nothing touches real customers or sends a message.

Step 1

Get a test key

In the Nimbuu dashboard, open Settings, then API keys, and make a secret key in test mode. It starts with sk_test_. We show it once, so copy it then.

Then set two variables. Every example below reads the address and the key from them.

A test key works on your shop's sandbox: a copy of your card and rewards with practice members. See Sandbox.

Shell
export NIMBUU_URL=https://nimbuu.in
export NIMBUU_KEY=sk_test_...
Step 2

Find or create the member, then add points

The first call gives the test number +91 00000 12345 a card, or returns the card it already has. The sandbox takes only test numbers: +91 00000 followed by any five digits.

The second adds points for a ₹250 bill. bill_amount_paise is in paise, so ₹250 is 25000. Each call sends its own Idempotency-Key: if your till retries with the same key, no points are added twice.

Save the curl example as quickstart.sh and run sh quickstart.sh, the Python one as quickstart.py and run python3 quickstart.py, or the Node one as quickstart.mjs and run node quickstart.mjs. Keep the .mjs ending: it uses import and await outside a function.

curl
#!/bin/sh
# Give a phone number a card, then earn on a ₹250 bill. Needs curl and openssl.
set -eu

# Each new request gets a new, random Idempotency-Key; a retry of the same request reuses it.
member=$(curl -sS --fail-with-body "$NIMBUU_URL/v1/members" \
  -H "Authorization: Bearer $NIMBUU_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(openssl rand -hex 16)" \
  -d '{"phone": "+910000012345"}')
member_id=$(echo "$member" | grep -o 'mem_[0-9a-f]*' | head -n 1)

curl -sS --fail-with-body "$NIMBUU_URL/v1/earn" \
  -H "Authorization: Bearer $NIMBUU_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(openssl rand -hex 16)" \
  -d "{\"member_id\": \"$member_id\", \"bill_amount_paise\": 25000}"
Python
"""Give a phone number a card, then earn on a ₹250 bill. Python 3.8 or later, no packages."""

import json
import os
import urllib.error
import urllib.request
import uuid

URL = os.environ["NIMBUU_URL"]
KEY = os.environ["NIMBUU_KEY"]


def post(path, body):
    request = urllib.request.Request(
        URL + path,
        data=json.dumps(body).encode(),
        headers={
            "Authorization": f"Bearer {KEY}",
            "Content-Type": "application/json",
            "Idempotency-Key": str(uuid.uuid4()),  # a new one for each new request
        },
    )
    try:
        with urllib.request.urlopen(request) as response:
            return json.load(response)
    except urllib.error.HTTPError as error:
        raise SystemExit(error.read().decode()) from None  # {"error": {"code", "message"}}


member = post("/v1/members", {"phone": "+910000012345"})
earned = post("/v1/earn", {"member_id": member["id"], "bill_amount_paise": 25000})
print(json.dumps(earned, indent=2))
Node
// Give a phone number a card, then earn on a ₹250 bill. Node 18 or later, no packages.
import { randomUUID } from "node:crypto";

const { NIMBUU_URL, NIMBUU_KEY } = process.env;

async function post(path, body) {
  const response = await fetch(NIMBUU_URL + path, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${NIMBUU_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": randomUUID(), // a new one for each new request
    },
    body: JSON.stringify(body),
  });
  const data = await response.json();
  if (!response.ok) throw new Error(JSON.stringify(data.error)); // {code, message}
  return data;
}

const member = await post("/v1/members", { phone: "+910000012345" });
const earned = await post("/v1/earn", { member_id: member.id, bill_amount_paise: 25000 });
console.log(JSON.stringify(earned, null, 2));
Step 3

Read the result

Each example prints the new transaction: its id, the points added and the balance after, so you can show them on the receipt.

On a points card the shop's rate applies, so a card with 1 point per ₹1 adds 250. On a stamp or visit card an earn adds one stamp or visit.

Response
{
  "id": "txn_48747400655e4519ab4116f4088048b2",
  "type": "earn",
  "amount": 250,
  "balance_after": 250,
  "member_id": "mem_f158cd641e544b89a3eaf88afbf27de7",
  "reward_id": null,
  "reverses_id": null,
  "bill_amount_paise": 25000,
  "bill_id": "",
  "location_id": null,
  "created_at": "2026-11-19T10:30:12.512331+05:30"
}

Going live

Every route, field and response is in the API reference, and in the Postman collection.