はじめに

Accept your first crypto payment

From an empty terminal to a signed webhook you have verified yourself. Seven steps, real endpoints, copy-paste ready.

7 ステップ4 分で読めますquickstartinvoiceswebhooks
ステップ 11 / 7

Create your account

The whole lifecycle. You write step 1 and step 4; steps 2 and 3 happen without you.

Signing up needs one thing: an email address. There is no password — your API key is your credential, which is why it is shown exactly once and stored only as a hash.

Open /register, or do it from a terminal:

bash
curl -X POST https://receivify.io/api/auth/register \
  -H 'content-type: application/json' \
  -d '{"email":"[email protected]"}'

A 201 comes back with merchant_id, api_key, api_key_prefix and webhook_secret, and opens a dashboard session cookie at the same time. Copy the key and the webhook secret into your secret manager before you close the terminal — neither is retrievable later.

ステップ 22 / 7

Issue a labelled API key

The signup key works immediately, but for anything beyond a first test you want labelled keys you can revoke one at a time. Issue one with your existing key or a dashboard session:

curl -X POST https://receivify.io/api/v1/keys \
  -H 'authorization: Bearer rcv_live_…' \
  -H 'content-type: application/json' \
  -d '{"label":"production"}'

Listing keys returns prefixes only, never the secret. Revoking one is POST /api/v1/keys/<id>/revoke — and the id is the key's id, not its prefix.

Every request to /api/v1/* authenticates with Authorization: Bearer <key>. Keep it server-side: it can create invoices and read every invoice on the account.

ステップ 33 / 7

Create your first invoice

POST /api/v1/invoices derives a fresh deposit address and hands you a hosted checkout page. Exactly one amount field is required; they are tried in this order and the first one present wins: amount_fiat (+currency), amount, amount_sats, amount_btc.

curl -X POST https://receivify.io/api/v1/invoices \
  -H "Authorization: Bearer rcv_live_…" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1042-attempt-1" \
  -d '{
    "amount_fiat": "49.99",
    "currency": "USD",
    "asset": "btc",
    "reference": "order-1042",
    "callback_url": "https://shop.example.com/hooks/receivify",
    "metadata": { "cart_id": "c_88f2" }
  }'

The response is always 201:

json
{
  "id": "82c6004a-a251-44f9-bbc7-9d22e03ee65c",
  "reference": "order-1042",
  "asset": "btc",
  "amount_expected": "250000",
  "amount_received": "0",
  "address": "bcrt1qam8t3w805yqehyy7hwl6sn5jlugkekfz2fpc5r",
  "status": "pending",
  "expires_at": "2026-07-26T20:53:00.000Z",
  "paid_at": null,
  "metadata": { "cart_id": "c_88f2" },
  "checkout_url": "https://receivify.io/pay/82c6004a-…"
}

Two things worth internalising now. reference de-duplicates: creating a second invoice under a reference you have already used returns the existing invoice with a 201, not a 409. And no money field is ever a JSON number — amount_expected is a string of whole base units, amount_fiat a decimal string. Parse them as strings.

ステップ 44 / 7

Send the customer to checkout

Redirect the buyer to the checkout_url from the response. The page shows the address, a QR code, the amount and a live countdown to expires_at.

If you are building your own checkout instead, poll the keyless public endpoint — it exposes status and amounts and nothing else, so it is safe in a browser:

curl https://receivify.io/api/public/invoices/82c6004a-…
# { "status": "confirming", "amount_expected": "250000", "amount_received": "250000", … }

Never put your rcv_live_… key in front-end code to do this. That is what the public endpoint is for.

ステップ 55 / 7

Point a webhook at your server

Set callback_url on the invoice (as above) or register a durable endpoint, and we POST every state change to it. The body is one envelope for every event:

json
{
  "event": "invoice.paid",
  "sequence": 41,
  "created_at": "2026-08-24T12:05:00.000Z",
  "data": { "id": "82c6004a-…", "status": "paid", "amount_received": "250000" }
}

Switch on event. The invoice events are invoice.confirming, invoice.partial, invoice.paid, invoice.swept, invoice.expired, invoice.partial_expired, invoice.cancelled and invoice.failed; sweep.sent fires when the net amount physically leaves the deposit address.

Delivery is at-least-once and can arrive out of order. sequence increases monotonically across all your deliveries — de-duplicate on it and ignore anything lower than a sequence you have already applied. The stored body never changes between retries, including its original created_at.

ステップ 66 / 7

Verify the signature

Every delivery carries an x-receivify-signature header:

http
x-receivify-signature: t=1753560000,v1=6f3b…

Compute HMAC-SHA256 of ${t}.${rawBody} with your webhook secret and compare in constant time. Use the raw body — not JSON you re-serialised, which will not byte-match.

import crypto from "node:crypto"

// `secrets` is an ARRAY: [current, previous?]. Pass one element when you are
// not mid-rotation — this signature then never has to change.
export function verify(rawBody, header, secrets) {
  const parts = Object.fromEntries(header.split(",").map((kv) => kv.split("=")))
  const sig = Buffer.from(parts.v1 || "")

  const ok = [].concat(secrets).some((secret) => {
    const expected = Buffer.from(crypto
      .createHmac("sha256", secret)
      .update(`${parts.t}.${rawBody}`)
      .digest("hex"))
    return sig.length === expected.length && crypto.timingSafeEqual(sig, expected)
  })
  if (!ok) throw new Error("bad signature")

  if (Math.floor(Date.now() / 1000) - Number(parts.t) > 300) {
    throw new Error("stale webhook")
  }
}

Take a list of secrets rather than one. During a rotation two are legitimately valid at once, and a receiver written against a single secret is a receiver you cannot rotate without downtime.

ステップ 77 / 7

Go live

Four things separate a working sandbox from a live integration:

  • Set a payout address, early. Changing it later is staged, email-confirmed and then held for a timelock before it takes effect — deliberately, so a stolen session cannot redirect your funds today.
  • Use https for callback_url. In production a non-https callback is rejected with 400 bad_request.
  • Send Idempotency-Key on every mutating POST. A replay returns the original body and the original status code, with Idempotent-Replay: true.
  • Turn on TOTP two-factor from Security in the dashboard (POST /api/v1/2fa/setup → /enable). Login then requires a 6-digit code.

Then read the API reference end to end once. It is shorter than it looks, and everything above is in it.

誤りや古い情報がありましたか?お知らせください。また、仕様から生成され常に優先されるAPI リファレンスもご確認ください。