Gift card code examples
This page is about gift cards, game keys, game top-ups and software keys. Selling eSIMs instead? See eSIM code examples.
curl, PHP, Node.js and Python.
Each example reads the key from the NOVACODES_KEY environment variable and uses nothing beyond the language's usual HTTP client.
List what is in stock
curl -s https://api.novacodes.app/v1/products \ -H "Authorization: Bearer $NOVACODES_KEY"
Place an order, retry-safe
The function retries timeouts, 429 and 5xx with the same reference, and stops on a refusal such as out_of_stock.
curl -s https://api.novacodes.app/v1/orders \
-H "Authorization: Bearer $NOVACODES_KEY" \
-H "Content-Type: application/json" \
-d '{"sku":"SKU0012","quantity":1,"balance":"USD","reference":"inv-2291-1"}'Generate the reference from something you already store, such as your invoice or order id, before the first attempt. A random value made inside the retry loop would defeat the protection.
Wait for a processing order
Most orders answer completed at once. When the status is processing, read the order until it changes.
curl -s https://api.novacodes.app/v1/orders/inv-2291-1 \ -H "Authorization: Bearer $NOVACODES_KEY"