Skip to content

Quickstart

This guide buys a 1GB bundle in the sandbox, where nothing is delivered or charged, and follows it until the network’s answer comes back.

  1. Get a sandbox key. Your Aura technical contact issues it. Sandbox keys start aura_test_. Keep the key on your server; never put it in an app or a browser. See Environments and access.

  2. Pick a bundle. List the bundles on your account and note an id.

    Terminal window
    curl https://sandbox.api.poweredbyaura.com/v1/bundles?available=true \
    -H "Authorization: Bearer $AURA_API_KEY"
  3. Buy it. Send your own unique reference with every purchase. It makes the request safe to retry.

    Terminal window
    curl https://sandbox.api.poweredbyaura.com/v1/purchases \
    -H "Authorization: Bearer $AURA_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "reference": "quickstart-0001",
    "phone_number": "+2348000000002",
    "bundle_id": "bnd_ng_a_1gb_1d"
    }'

    The response is the purchase, usually with "status": "pending" and a resolve_by time: the latest moment it will reach a final state.

  4. Follow it to a final state. Look it up by your reference until status is no longer pending. In production, use a webhook instead of polling.

    Terminal window
    curl "https://sandbox.api.poweredbyaura.com/v1/purchases?reference=quickstart-0001" \
    -H "Authorization: Bearer $AURA_API_KEY"

    successful means the network confirmed the bundle was credited to the number. failed means it was not, and nothing was charged.

In the sandbox, these numbers produce each outcome on purpose. Any other number is refused with invalid_phone_number.

Number What happens
+2348000000001 successful straight away
+2348000000002 pending, then successful about a minute later
+2348000000003 failed with number_not_eligible
+2348000000004 stays pending, then failed with network_timeout at its resolve_by, which the sandbox sets five minutes after creation
+2348000000005 successful, then reversed about five minutes later
+2348000000007 a ported number: Look up a number’s network returns ported: true