83trust / 100

Invoice Create

by Bitrefill in Markets & finance

x402 APIPassing, checked 3 h ago

Create a price-locked USDC invoice for one or more gift cards, eSIMs, or mobile top-ups.

POST https://api.bitrefill.com/x402/invoice/create

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
263 ms typical, 263 ms slowest 5%
Last check
3 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://api.bitrefill.com/x402/invoice/create" \
  -H "content-type: application/json" \
  -d '{"items":[{"package_value":"25","product_id":"amazon-us"}]}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fapi.bitrefill.com%2Fx402%2Finvoice%2Fcreate
const res = await pay("https://api.bitrefill.com/x402/invoice/create", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"items":[{"package_value":"25","product_id":"amazon-us"}]}),
});
console.log(await res.json());

Example input

{
  "items": [
    {
      "package_value": "25",
      "product_id": "amazon-us"
    }
  ]
}

Example output

{
  "expires_in_minutes": 15,
  "invoice_id": "c2b27180-610e-4132-af77-ad42fc0ac444",
  "networks": [
    "eip155:8453",
    "solana:mainnet"
  ],
  "next_step": {
    "body": {
      "invoice_id": "c2b27180-610e-4132-af77-ad42fc0ac444"
    },
    "url": "/x402/invoice/pay"
  },
  "price_usd": 25,
  "price_usdc": "25000000"
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
3 h agoPassed402263 ms$0.002
8 h agoPassed402766 ms$0.002