Skip to content
FlatCryptoPay
Native REST API

Crypto Payment API: Create Invoices and Get Paid to Your Wallet

The FlatCryptoPay REST API lets you create crypto invoices with one POST request, send customers to a hosted pay page, and receive signed webhooks when they pay. Payments in USDT, USDC, Bitcoin and Litecoin go straight to your own wallet, and every plan includes full API access with no percentage fee.

Last verified

Requirements

  • A FlatCryptoPay account with at least one payout address.
  • An API key from the dashboard (fcp_test_ for testing, fcp_live_ for production).
  • An HTTPS endpoint to receive webhooks, plus its whsec_ signing secret.
  • Any HTTP client: curl, fetch, PHP, Python, Go or similar.

Setup steps

  1. 1

    Create an API key

    In the dashboard create a test key. It is shown once and stored only as a salted hash, so save it in your secrets manager.

  2. 2

    Create an invoice

    POST to https://flatcryptopay.com/api/v1/invoices with amount, currency and optional order_id, description, customer_email, redirect_url, cancel_url, metadata and expires_in.

  3. 3

    Redirect the customer

    Send the customer to the hosted_url in the response. They choose a coin and network, or card, and pay.

  4. 4

    Handle webhooks

    Add an endpoint in the dashboard. Verify X-FCP-Signature, which is the hex HMAC-SHA256 of timestamp + "." + raw body using your signing secret, then fulfil on invoice.paid.

  5. 5

    Go live

    Swap the fcp_test_ key for an fcp_live_ key and the live webhook secret.

Create an invoice with curl
curl https://flatcryptopay.com/api/v1/invoices \
  -H "Authorization: Bearer fcp_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1001" \
  -d '{
    "amount": "25.00",
    "currency": "USD",
    "description": "Order #1001",
    "order_id": "1001",
    "customer_email": "buyer@example.com",
    "redirect_url": "https://shop.example/thanks",
    "metadata": { "plan": "pro" }
  }'

# 201 Created
# { "id": "inv_8fK2...", "object": "invoice", "status": "open",
#   "hosted_url": "https://flatcryptopay.com/pay/inv_8fK2.../", ... }

Endpoints

The base URL is https://flatcryptopay.com/api/v1 and every request is authenticated with Authorization: Bearer followed by your key. POST requests accept an optional Idempotency-Key header, so retries never create duplicate invoices.

MethodPathPurpose
POST/invoicesCreate an invoice and get a hosted_url
GET/invoices/{id}Retrieve one invoice and its payment
GET/invoices?limit=20&status=paidList invoices with cursor pagination (starting_after)
POST/invoices/{id}/cancelCancel an open invoice
POST/payment_linksCreate a reusable payment link
GET/payment_linksList payment links

Invoice lifecycle

An invoice starts as open. When a matching payment is seen on-chain it moves to processing while it waits for confirmations, then to paid. Unpaid invoices become expired after expires_in minutes (15 to 10,080, default 1,440), and you can cancel open invoices yourself. When paid, the payment object tells you how the customer paid: via crypto or card, the method such as usdt_tron, the exact amount, asset, network and tx_hash.

Confirmation targets are conservative: 1 confirmation for Bitcoin, 2 for Litecoin, 12 blocks on Ethereum, Base and BNB Smart Chain, 64 on Polygon, 19 on TRON and finalized on Solana. Stablecoins are matched by a unique amount reserved for 60 minutes; Bitcoin can use a fresh address per invoice derived from your watch-only xpub.

Webhooks

Events are invoice.processing, invoice.paid, invoice.expired, invoice.canceled and test.ping. Each delivery is a JSON body with id, type, created, livemode and data.invoice, plus headers X-FCP-Event, X-FCP-Event-Id, X-FCP-Timestamp and X-FCP-Signature. Recompute the signature over the raw body, compare in constant time, reject timestamps older than five minutes and deduplicate on the event ID. Respond with a 2xx within 10 seconds; failed deliveries are retried up to 6 attempts with backoff of 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours.

Errors and testing

Errors return a JSON error object with type (invalid_request_error, authentication_error, rate_limit_error or api_error), a code and a human-readable message, with standard HTTP status codes. In test mode, test keys create test invoices, the pay page shows a Simulate payment button, and webhooks arrive with livemode false, so you can build the whole flow before touching real funds.

Frequently asked questions

Is the API available on the free plan?

Yes. API access and webhooks are included on every plan, including Starter at $0 per month.

Is there a sandbox?

Yes. fcp_test_ keys create test invoices, the pay page offers a Simulate payment button, and webhooks are sent with livemode false.

How do I verify webhooks?

Compute HMAC-SHA256 with your whsec_ secret over the X-FCP-Timestamp value, a dot and the raw body, hex-encode it and compare it to X-FCP-Signature in constant time.

Can I price in fiat?

Yes. Invoices accept USD, EUR, GBP, CAD and AUD. Stablecoins are 1:1 with USD; Bitcoin and Litecoin quotes are locked for 30 minutes.

Do I need to handle private keys?

No. You give us receiving addresses or a watch-only xpub. We never see or need private keys.

Are there rate limits?

Yes. If you exceed them you receive a 429 with a rate_limit_error; back off and retry.

Related

Start accepting crypto in minutes

Create a free account, add your wallet addresses and send your first invoice. No business documents, no percentage fees, no custody.

Start free: no fees, no documents