Crypto payment API
The FlatCryptoPay crypto payment API lets you create an invoice with one POST request and receive a signed webhook when it is paid, with the funds going directly to your wallet. It is a compact REST API with bearer-token auth, idempotency keys, cursor pagination and a full test mode.
One call to get paid
POST /invoices with an amount and currency returns a hosted_url you redirect the customer to.
Idempotent writes
Send an Idempotency-Key header on POST requests so retries never create duplicate invoices.
Signed webhooks
HMAC-SHA256 over timestamp and raw body, with event IDs for deduplication and up to six delivery attempts.
Real test mode
fcp_test_ keys, simulated payments on the pay page and livemode=false events.
POST /api/v1/invoices
Authorization: Bearer fcp_live_...
Idempotency-Key: order-1001
{ "amount": "120.00", "currency": "EUR", "order_id": "1001",
"customer_email": "buyer@example.com",
"redirect_url": "https://shop.example/thanks" } Endpoints
The base URL is https://flatcryptopay.com/api/v1 and every request authenticates with Authorization: Bearer followed by your fcp_live_ or fcp_test_ key.
| Method | Path | Purpose |
|---|---|---|
| POST | /invoices | Create an invoice |
| GET | /invoices/{id} | Retrieve an invoice |
| GET | /invoices | List invoices, filter by status, paginate with starting_after |
| POST | /invoices/{id}/cancel | Cancel an open invoice |
| POST | /payment_links | Create a payment link with a fixed or customer-chosen amount |
| GET | /payment_links | List payment links |
Creating an invoice
Required fields are amount, as a decimal string such as 25.00, and currency: USD, EUR, GBP, CAD or AUD. Optional fields are description, order_id, customer_email, redirect_url, cancel_url, metadata (up to 20 keys with string values up to 500 characters) and expires_in in minutes, from 15 to 10080, defaulting to 1440.
The response is an Invoice object with id, status, amount, currency, hosted_url, expires_at and a payment field that is null until paid. When paid, payment contains via (crypto, card or simulated), method such as usdt_tron, the exact amount, asset, network and tx_hash.
Webhooks
Register an HTTPS endpoint and you receive invoice.processing, invoice.paid, invoice.expired, invoice.canceled and test.ping events. Each POST carries X-FCP-Event, X-FCP-Event-Id, X-FCP-Timestamp and X-FCP-Signature. The signature is the lowercase hex HMAC-SHA256 of the timestamp, a dot and the raw request body, keyed with your whsec_ signing secret.
- Verify against the raw body before parsing JSON.
- Compare signatures in constant time.
- Reject timestamps older than five minutes.
- Deduplicate on X-FCP-Event-Id.
- Respond with any 2xx within 10 seconds; otherwise we retry at 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours.
Errors and rate limits
Errors return a JSON body with error.type (invalid_request_error, authentication_error, rate_limit_error or api_error), a machine-readable code and a human message, with HTTP status 400, 401, 404, 409, 422, 429 or 500. A 409 usually means an idempotency key was reused with a different body; a 429 means slow down and retry with backoff.
Why a small API
Most crypto payment APIs expose dozens of endpoints for balances, payouts, conversions and sub-accounts, because the provider holds your funds. A non-custodial API does not need any of that. The surface is invoices, payment links and webhooks, which means less to learn, less to break and less to secure. Coin selection, address display, QR codes, rate locks and card checkout all happen on the hosted page.
Frequently asked questions
What is a crypto payment API?
It is an interface that lets your software create crypto payment requests and learn when they are paid. With FlatCryptoPay you create invoices over REST and receive signed webhooks.
How do I integrate a crypto payment gateway API?
Create an API key, call POST /invoices when the customer checks out, redirect them to the hosted_url, and fulfil the order when your webhook receives invoice.paid. The quickstart walks through it in a few minutes.
Is there a free crypto payment API?
Yes. The Starter plan includes the full API and webhooks at $0 for up to $2,000 of monthly volume, and test mode is free on every plan.
Do you have SDKs?
The API is plain JSON over HTTPS and works with any HTTP client. The docs include copy-paste examples, and the WooCommerce plugin is available for WordPress stores.
How do I verify webhook signatures?
Compute HMAC-SHA256 with your whsec_ secret over the X-FCP-Timestamp value, a dot and the raw body, compare it in constant time with X-FCP-Signature, and reject timestamps older than five minutes.
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.