Recvd

API and
webhooks.

Tie a sale to your own user, read and change your sales from your server, report usage, and be told the moment a sale is paid, refunded or disputed.

Keys and webhook addresses are made on the Developers page of the Recvd app. A key reads; a key made to write can also do what you do in the app, such as add a product, refund a sale or report usage.

curl "https://recvd.co/api/v1/sales?reference=user_8231" \
  -H "Authorization: Bearer rk_..."

Your reference on a checkout link

Add ?ref= to a product's checkout link with your own id for the buyer, up to 200 characters. It comes back as reference on the sale, on every renewal of a subscription started from that link, and in every event. Add &email= to fill in the buyer's email, and &qty= to start the checkout on a quantity or a number of seats. Add &lang= with es, fr, de, it, pt or nl to open the checkout in that language; without it the checkout follows the buyer's browser, and is in English for any other language.

https://recvd.co/buy/<your product's link>?ref=user_8231&email=ada%40example.com

The reference is typed into a link, so a buyer can change it. Use it to find the sale, then trust what the API or a signed event says about it.

Test mode

Open test mode on the Developers page to try all of this without real money. It gives your business a test twin: a second copy with its own products, checkout links, API keys and webhook addresses, running on the payment partner's sandbox. The products you have on sale are copied across when you open it. Choose the twin at the top of any page in the app to work in it. You can open it before you accept the merchant of record terms.

A test checkout says it is one, and takes test cards only: 4242 4242 4242 4242 with any later date and any three digits pays; 4000 0000 0000 0002 is declined. A key made in the twin reads and changes the twin only. Every event carries "test", which is true from the twin and false from your real business, so one endpoint that hears both can tell them apart; never give anyone what they bought on an event whose test is true. Emails about a test sale have [Test] at the start of the subject.

Test sales are never paid out, so payouts, partners and affiliates are not part of test mode. A product you add in the twin is on sale at once; in your real business it still waits for a person at Recvd. Tax in a test checkout is worked out by the sandbox and can differ from what a real buyer is charged.

Partners and affiliates

On your Sales page you can share a product's sales with a partner, and give an affiliate a share of each sale that comes through its link. An affiliate's link is your checkout link with ?aff= and the affiliate's code; it works together with ref and with the checkout button. A share is a percentage of the price after Recvd's fee. Recvd pays each partner directly, in the same weekday run as you, so you send nobody money yourself.

https://recvd.co/buy/<your product's link>?aff=k7m2p9xq4d

The affiliate is credited when the buyer pays on the page that link opened. On a subscription the affiliate shares in every payment.

An affiliate can also link to your own site, if it has the checkout button script. A visitor who arrives on any page of your site with ?aff= and a code on its address has that code kept in their browser's storage for your site for 30 days, and every link to a Recvd checkout on your site carries it in that time, so a buyer who comes back later is still counted. A newer code replaces an older one, and a checkout link that names its own affiliate keeps it. The code names the affiliate and says nothing about the visitor. It is your site that stores it, so tell your visitors as your own site's rules require. To switch it off, put data-affiliates="off" on the script tag, and nothing is stored.

https://your-site.example/pricing?aff=k7m2p9xq4d

<script src="https://recvd.co/recvd.js" data-affiliates="off" async></script>

A checkout button on your own site

Add one script to your page and the attribute data-recvd to a link to your checkout. A click then opens the checkout in a small window over your page, with every payment method the buyer would get on the full page, and your page stays where it was. Without the script, or if the browser blocks the window, the link opens the checkout as usual.

<script src="https://recvd.co/recvd.js" async></script>

<a href="https://recvd.co/buy/<your product's link>?ref=user_8231" data-recvd>Buy Pro</a>

<script>
  document.addEventListener("recvd:paid", function (event) {
    // event.detail.checkout is the product's link. Now ask your own server,
    // which checks the sale with the API or a webhook before unlocking anything.
  });
</script>

Your page hears recvd:paid when the buyer has paid, recvd:trial when a free trial has started, recvd:saved when a payment method was saved for a product with no monthly fee, and recvd:pending when a bank payment is on its way. These are a signal for the page, sent by the buyer's browser: never give anyone what they bought on the event alone. It is a window, not a frame, because wallets such as Apple Pay do not work inside a frame on another site.

Authentication

Send your key as a bearer token over HTTPS. A key belongs to one business and reaches only that business. A key reads unless you make one that may also write; make that kind only for a server that needs it. Keep every key on your server: a key in a web page or an app is public.

curl "https://recvd.co/api/v1/sales?reference=user_8231" \
  -H "Authorization: Bearer rk_..."

A missing, wrong or revoked key answers 401. More than 120 requests a minute answers 429. Errors are JSON with an error message.

Requests

The base address is https://recvd.co/api/v1. Everything is JSON.

RequestWhat it returns
GET /productsEvery product, newest first.
GET /products/{id}One product.
GET /salesPaid, refunded and disputed sales, newest first. Filter with reference or buyer_email.
GET /sales/{id}One sale.
GET /subscriptionsSubscriptions, newest first. Filter with reference or buyer_email.
GET /usage_chargesThe charges for usage, newest first, each pending, paid or failed, with its memo: the ones you asked for and the daily ones made from your usage events. Filter with subscription_id.
GET /usage_charges/{id}One usage charge.
GET /usage_eventsThe usage events you sent, newest first, each counted (waiting for the day's charge), charged, spent (from credits) or not_charged, with the usage charge it went into. Filter with subscription_id, or with reference or buyer_email for a credits account. GET /usage_events/{id} is one event, and task_id filters to one task's.
GET /tasksThe tasks you opened, newest first, each with its budget, what it has used, what is left and whether it is open or closed. Filter with subscription_id, or with reference or buyer_email. GET /tasks/{id} is one task.
GET /subscriptions/{id}One subscription.
GET /discount_codesYour discount codes.
GET /partnersThe people and companies you share sales with: their status (pending, active, stopped), affiliate share and code, product splits, and what they have earned.
GET /creditsA buyer's prepaid credits with you: the balance and the last entries. Say whose with reference (your own id for the buyer, from the checkout link) or buyer_email.
GET /license_keys/{key}One licence key of yours: its product, its sale or subscription, whether it is still valid, the installs it allows (activation_limit, null when they are not counted) and the ones it is in use on. A key is valid until its sale is refunded or its subscription ends. 404 for a key that is not yours.
GET /buyersEveryone who has bought from you, the latest to buy first: sales that stand, what they came to in US dollars, refunded sales, first and last purchase, subscriptions running. Filter with buyer_email.
GET /disputesYour disputes, newest first: the sale, where the dispute stands (open, won, lost), whether Recvd has answered the bank, the bank's reason, the amount, the date an answer is due, and your own note and records. GET /disputes/{dispute_id} is one dispute with Recvd's record of the sale as well.
GET /statsWhere your subscriptions stand today (running, in a free trial, paused, behind on payment, ending, ended), what the running ones bill each month by currency, and the last 30 days of sales in US dollars.
GET /eventsYour events of the last thirty days, oldest first, each as a webhook address is sent it: the latest ones, or with after set to the id of an event, the ones made after it. Up to 100 at a time with limit.

A list answers { "object": "list", "data": [...], "has_more": true }. Ask for up to 100 at a time with limit (25 if you leave it out), and for the next page with starting_after set to the id of the last one you have.

A sale looks like this. Amounts are in cents. buyer_currency, buyer_subtotal_cents and buyer_tax_cents are what the buyer paid, in the currency the product is priced in (usd, eur, gbp or another from the list under What it does not do yet). Every other amount is in US dollars: for a sale in another currency it is what the payment became once converted, and it is what your fee, reserve and payout are worked out on. subtotal_cents is your price; tax_cents is sales tax, which is never yours; fee_cents is Recvd's fee and reserve_cents the reserve held on it. status is paid, refunded or disputed.

{
  "id": "5c0f7d0e2b1a4f6c9d8e7a6b5c4d3e2f",
  "object": "sale",
  "product_id": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
  "subscription_id": null,
  "reference": "user_8231",
  "buyer_email": "ada@example.com",
  "buyer_name": "Ada Lovelace",
  "buyer_country": "US",
  "quantity": 1,
  "buyer_currency": "usd",
  "buyer_subtotal_cents": 4900,
  "buyer_tax_cents": 294,
  "payment_method": "card",
  "buyer_company": null,
  "buyer_tax_id": null,
  "subtotal_cents": 4900,
  "tax_cents": 294,
  "fee_cents": 392,
  "reserve_cents": 490,
  "currency": "usd",
  "status": "paid",
  "paid_on": "2026-11-11",
  "paid_out_on": null,
  "refunded_on": null,
  "refunded_cents": 0,
  "buyer_refunded_cents": 0,
  "invoice_url": "https://recvd.co/api/invoice/…",
  "partner_cents": 0,
  "affiliate_id": null,
  "created_at": "2026-11-11T15:04:05.000Z"
}

A product has name, description, price_cents, currency (usd, eur, gbp or another from the list under What it does not do yet), billed (once, month or year), status (on_sale, in_review, not_approved or off_sale) and checkout_url. A subscription has product_id, reference, buyer_email, status (active, past_due or canceled), renews_on and cancel_requested_on.

Changing things

These need a key made to write (on the Developers page, choose that when you make the key). Each does exactly what you can do yourself in the Recvd app, and nothing more. Send JSON; the answer is the object as it now stands. A key that only reads gets 403.

RequestWhat it does
POST /checkout_linksThe checkout address for a product on sale, with your reference on it. Body: product_id, and optionally reference, quantity (how many the checkout starts on, for a product sold in quantities or by the seat) and lang (the language it opens in). Changes nothing, so any key may call it.
POST /productsAdd a product. It is not on sale until a person at Recvd has approved it. Body: name, description, price_cents (0 for a product with no monthly fee, described under Usage below), tax_code, and optionally currency (usd when left out; the fifteen are listed below), billed (once, month, year), trial_days, license_keys, key_activations (the installs one key allows, up to 1000; leave it out and they are not counted), pay_what_you_want (true and the buyer chooses the price, from price_cents up; a product billed once), usage_cents and usage_unit (for a subscription: the price of one unit of usage and what a unit is called), usage_cap_cents (the most one subscription is charged for usage in a calendar month, UTC; the checkout shows it), meters (for a subscription: up to ten more kinds of usage, each { key, unit, cents }, for example input tokens and output tokens at their own prices; a meter can also sell credits, with credits (how many prepaid credits one unit adds when its charge is paid) and topup_at (the balance at which one unit is charged by itself; needs credits and a usage_cap_cents); the checkout shows every one, and like the price they cannot be changed afterwards), question (one question each buyer is asked at checkout, up to 120 characters; what they typed comes back as answer on the sale and the subscription; never ask for a password, a card number or a government ID) and question_required (true and the buyer has to answer), max_quantity (the most one buyer may buy at one checkout, 1 to 1000).
POST /discount_codesAdd a discount code; it works at once. Body: code, percent_off, and optionally product_id, max_uses, ends_on.
POST /sales/{id}/refundRefund a paid sale. With no body, all of it. With amount, that part: what goes back to the buyer, tax included, in the smallest unit of buyer_currency. What you were paid for it, or the matching part, is taken back first. It cannot be undone.
POST /subscriptions/{id}/cancelSet a subscription to end when the period already paid for is over. It cannot be undone.
POST /subscriptions/{id}/changeMove a running subscription to another of your subscription products. Body: product_id. A dearer plan, or monthly to yearly, charges the buyer the difference at once, less what they have already paid for the period, and is not made if that payment fails (402). A cheaper plan charges nothing now, gives nothing back, and applies its price from the next renewal. A move that would owe the buyer money is refused (409): a yearly subscription that has been paid for does not move to a monthly plan.
POST /subscriptions/{id}/seatsSet how many seats a running subscription has. Body: seats, a whole number up to the product's max_quantity. Seats beyond what the buyer has already paid for in the period are charged at once, for the rest of the period, and are not added if that payment fails (402). Fewer seats, or seats taken off earlier in the period and put back, charge nothing now and give nothing back; the new price applies from the next renewal.
POST /usage_eventsReport usage as it happens, and Recvd adds it up. Body: quantity (how many units), idempotency_key (your own id for this event, up to 180 characters: an event sent twice with the same key counts once and gets the first answer), optionally memo, and who used it: subscription_id, or reference or buyer_email for a credits account. Where the product has meters, meter is the key of the one the usage is for. To send up to 100 at once, put them in events: each is counted or refused by itself, and data answers each in its place, with object error, status and error for one that was refused. With subscription_id the event is counted and the units are charged once a day as one usage charge, at the product's usage_cents: the charge is in GET /usage_charges and the sale arrives as sale.paid with usage_quantity. 409 when the subscription could not be charged for usage now: it is in a free trial, paused, set to end, behind on payment, or on a product without a usage price. With reference or buyer_email the units are credits, spent at once, and the answer carries the balance left; 409 when there are not enough, and nothing is counted. Up to 600 events a minute.
POST /tasksOpen a task with a budget before a piece of work starts: the most it may use. Body: budget (whole units), idempotency_key (your own id for the task: a request sent twice opens one task), optionally memo, and whose it is: reference or buyer_email for a credits account, or subscription_id. For a credits account the budget is held out of the buyer's balance at once, so nothing else can spend it while the task is open; 409 when there are not enough credits. For a subscription the budget is money, in the smallest unit of the product's currency, and nothing is held: each event takes its units times the price of its meter. A task ends by itself after a day, or after expires_in_minutes (up to 43200, thirty days): no usage is counted after that, and it is closed within about a minute. Then send usage with POST /usage_events and task_id in place of who used it: the event is counted against the task, and 409 when it would pass the budget (nothing is counted).
POST /tasks/{id}/closeClose a task when its work is done. No more usage is counted against it, and a credits task gives back what it held and did not use. Closing it again changes nothing.
POST /credits/alertSet the balance at which your webhook addresses are told a buyer's credits are running low (credits.low). Body: at, a whole number; null, or left out, for no alert.
POST /subscriptions/{id}/usageCharge a subscriber for usage. Body: quantity (how many units, at the product's usage_cents, or at the price of the meter named by meter), idempotency_key (your own id for this charge: a request sent twice with the same key charges once and gets the first answer), and optionally memo. The subscription's payment method is charged at once and the sale arrives as sale.paid with usage_quantity. 402 when the payment method is refused: nothing is charged and it is not tried again. 400 when the amount is too little to charge by itself: add usage up and charge it in larger amounts. 409 when the product has a usage_cap_cents and this charge would take the subscription past it for the calendar month: nothing is charged, and the same idempotency_key may be sent again next month.
POST /subscriptions/{id}/pausePause a monthly subscription. Body: months, 1 to 3: the renewals to skip. The period already paid for runs out as usual, and the subscription starts again by itself.
POST /subscriptions/{id}/resumeEnd a pause early.
POST /license_keys/{key}/activatePut a key to use on an install. Body: instance, your own name for it (a device id, a hostname), up to 200 characters. Asking again for the same install changes nothing, so you can call it each time your software starts. 409 when the key is in use on every install it allows, or is not valid now.
POST /license_keys/{key}/deactivateTake a key off an install, which frees a place. Body: instance.
POST /partnersAdd a partner. Recvd emails it a private link to its own page, where it sets up its payouts. Body: name, email, and optionally country (two letters, US when left out), kind (person, company), affiliate_percent.
POST /partners/{id}/splitGive a partner a share of every sale of a product from now on. Body: product_id, percent (of the price after Recvd's fee; 0 ends it). The partners of one product share at most 90% between them.
POST /partners/{id}/stopEnd a partner: no share of any sale from now on. What it is already owed is still paid. It cannot be undone.
POST /partners/{id}/approveSay yes to someone who asked on your affiliate sign-up page. It becomes an affiliate and is emailed its link.
POST /partners/{id}/declineSay no to someone who asked on your affiliate sign-up page. The request is removed.
POST /disputes/{dispute_id}/noteSay what happened with a disputed sale, in your own words. Body: note, up to 4,000 characters; it replaces the note before it. Only while the dispute is open and Recvd has not answered yet (409 after).
POST /disputes/{dispute_id}/proofAdd your own records to an open dispute. Body: any of access_activity_log (what the buyer did with the product, with dates, up to 15,000 characters), customer_account_id (the buyer's account with you), customer_purchase_ip (the IP address your site saw when you sent the buyer to the checkout), customer_device_id (15 characters or more) and customer_device_fingerprint (20 or more). With sale_id, the last four are about one of the earlier sales listed on the dispute instead. Each request changes only what it names; null takes a record away.
POST /credits/useSpend a buyer's credits. Body: reference or buyer_email, amount, and optionally memo and idempotency_key (a request sent twice with the same key spends once). 409 when there are not enough.
POST /credits/grantGive a buyer credits outside a sale. Body: reference or buyer_email, amount, and optionally memo.

A customer portal in your own app

Your server can show a signed-in user of your app what they have bought from you and let them act on it there, so nobody has to look for a receipt. GET /portal works with any key; the POST requests need a key made to write. Each of them acts as the buyer: it is held to what the buyer could do on their own Recvd page, so a plan outside the plan group, or a pause you have not allowed, is refused. The answer is the subscription as GET /portal gives it.

RequestWhat it does
GET /portalEverything one buyer has with you. Say whose with reference (your own id for the buyer, from the checkout link) or buyer_email. The answer has subscriptions (each with product, price_cents for one seat, currency, billed, quantity, status, lower_price, files, and can: what the buyer may do alone today), sales (the latest 36 payments, each with invoice_url, and files_url for a one-time purchase with files; sales_has_more says there are older ones, which GET /sales lists) and credits (the balance). It never carries a portal link. Any key.
POST /portal/{subscription_id}/linkThe buyer's own link to their subscription page on Recvd. The link is the buyer's key: whoever holds it can do what the buyer can. Give it only to the signed-in user it belongs to, and keep it out of logs.
POST /portal/{subscription_id}/cancelCancel for the buyer: the subscription ends when the period paid for is over. Body, optional: reason (too_expensive, not_using, missing, switched, done or other) and note, the buyer's own words, up to 200 characters. A reason that is not one of these is left out and the cancellation still goes through. It cannot be undone.
POST /portal/{subscription_id}/reasonSay why a cancelled subscription was cancelled. Body: reason, and optionally note. The first answer stands.
POST /portal/{subscription_id}/changeMove the buyer to another plan. Body: product_id, one of can.plans: a product you gave the same plan group. It is charged as any plan change is.
POST /portal/{subscription_id}/seatsSet the buyer's seats. Body: seats. Only where can.change_seats is true.
POST /portal/{subscription_id}/pausePause for the buyer. Body: months, 1 to 3. Only where you let subscribers pause by themselves (can.pause).
POST /portal/{subscription_id}/resumeEnd the buyer's pause early.
POST /portal/{subscription_id}/lower_priceThe buyer keeps the plan at the lower price you offer before a cancellation (can.offers.lower_price). Body, all required: price_cents, renewals and then_cents as you showed them to the buyer; if they are not what is on offer now, the answer is 409 and nothing is taken. Nothing is charged or given back now. The lower price is charged from the next renewal, for the number of renewals you set, and the regular price comes back by itself after them.
POST /portal/offersChoose what a subscriber is shown when they press cancel. Body: on (true or false), and optionally percent (the lower price, as 1 to 90 percent off what the subscriber pays; 0 for none) and renewals (1 to 12).

A payment method is changed only on the buyer's own page, in the payment partner's fields: ask for the link and send the buyer there. A subscription's files are downloaded there too.

Before a cancellation: switch it on, on the Sales page or with POST /portal/offers, and a subscriber who presses cancel on their Recvd page sees one screen first. The cancel button is at the top of it and one press cancels. Under it is what applies to that subscriber: a pause where you allow pausing, a cheaper plan of the same plan group billed the same way, and the same plan at a lower price for a number of renewals. The lower price is for a monthly subscription, once for each subscription, and it is not offered where your fee could not carry it. Your fee and reserve are worked out on what the buyer pays. In your own app, can.offers says what to show; show the cancel button with it, never after it. A buyer who cancels is asked why afterwards and need not answer. What they say is cancel_reason and cancel_note on the subscription, and subscription.updated is sent when they answer. Recvd decides nothing by it.

The MCP server has the same as four tools: get_buyer_portal, get_portal_link, buyer_subscription_action and set_cancel_offers.

Disputes and fraud warnings

When a buyer's bank disputes a sale, Recvd answers the bank, because Recvd is the seller. The sale is frozen until the bank decides (sale.disputed). A person at Recvd reads the answer and sends it, once; no key and no tool can draft or send it. What you can do is read the dispute and add what only you know.

GET /disputes/{dispute_id} carries record, which is what Recvd already holds: delivery (dated lines: the receipt, a licence key and the installs it was used on, files downloaded, credits added and spent, usage you reported), earlier_sales (the buyer's earlier sales with you that were not disputed) and compelling_evidence. For a dispute that says the buyer did not make the purchase, a card network may take two earlier undisputed purchases by the same buyer as proof, if details match across all three. compelling_evidence.eligible says whether this dispute is one of those, ready whether the record has what is needed, and missing what is not there yet. Recvd holds the buyer's email address and your reference for them. It does not hold the IP address or the device they bought from. The payment partner usually holds the address the disputed sale was paid from, so what is most often missing is the address or device for each earlier sale marked used, which can only come from you, with POST /disputes/{dispute_id}/proof. Each time you add a record it is put to the payment partner, and compelling_evidence.partner carries its answer: status is qualified, requires_action or not_qualified. Everything you add is sent to the buyer's bank with the answer. Send only records you hold. The bank decides, and no record makes its answer certain.

A fraud warning comes before any dispute, and a dispute may or may not follow (sale.fraud_warning). Recvd keeps the sale out of your payouts and emails you. If you do not know the buyer, you can refund the sale with POST /sales/{id}/refund.

For AI agents: the MCP server

An agent that speaks the Model Context Protocol can work with your Recvd account at https://recvd.co/api/mcp, with the same API key. Its tools are the requests on this page: list and read products, sales, subscriptions, disputes and discount codes, check a licence key, make a checkout link, and, with a key that may write, add a product or a discount code, refund a sale, cancel a subscription and add your note and records to a dispute. A tool can do nothing its key cannot.

claude mcp add --transport http recvd https://recvd.co/api/mcp \
  --header "Authorization: Bearer rk_..."

Give an agent a key that may write only if you would let it refund a sale. The tools that cannot be undone are marked as such, so an agent that respects that asks you first.

Webhooks

Add a public HTTPS address on the Developers page and Recvd posts a JSON event to it when something happens, usually within a minute. Answer with any 2xx status within eight seconds. Anything else is tried again after 1, 5 and 30 minutes, then 2, 6, 12 and 24 hours, and then marked failed. The Developers page lists the last events and how each went.

EventWhen
sale.paidA sale was paid: a one-time purchase, a subscription's first period or a renewal. data.sale
sale.refundedA sale was refunded to the buyer, in full or in part, or a dispute on it was decided for the buyer. After a part refund the sale is still paid, at lower amounts, and buyer_refunded_cents says what has gone back. data.sale
sale.disputedThe buyer disputed the charge with their card issuer. The sale is held until the issuer decides: sale.refunded follows if it decides for the buyer, and nothing is sent if it decides for Recvd (read the sale to see it paid again). data.sale
sale.fraud_warningThe bank that issued the buyer's card has told the card network that it thinks the payment may be fraud. It is a warning, not a dispute, and no money has moved. The sale is kept out of your payouts until it is refunded or a person at Recvd releases it. data.sale
subscription.updatedA subscription became active, fell behind on payment, was cancelled or ended, or its buyer said why they cancelled. data.subscription
payout.sentA payout run sent money to your bank account. data.payout has total_cents and the number of lines.
credits.lowA spend took a buyer's prepaid credits to the number you set on the Developers page, or under it. Sent each time that line is crossed. data.credit_balance has account, balance and alert_at.
usage.not_chargedThe daily charge closed usage you reported for a subscription without charging it. data.usage has subscription_id, meter, quantity, reason (cap: past the product's monthly cap; payment_refused: the payment method was refused; subscription: it could no longer be charged for usage) and usage_charge_id where there is one.
task.budget_reachedUsage for a task was refused because it would pass the task's budget. Sent once for each task, the first time. data.task
pingA test event you send from the Developers page.
{
  "id": "evt_3f9a1c2b4d5e6f708192a3b4",
  "type": "sale.paid",
  "test": false,
  "created": "2026-11-11T15:04:06.120Z",
  "data": { "sale": { "id": "5c0f7d0e…", "object": "sale", "reference": "user_8231", "status": "paid" } }
}

An event can arrive more than once, and two events can arrive out of order. Use the event's id to ignore a repeat, and read status from the object rather than assuming it from the event's name.

Checking a signature

Every event carries a Recvd-Signature header: t= a Unix time and v1= the HMAC-SHA256, in hex, of that time, a full stop and the raw body, keyed with the address's signing secret. Check it before you believe an event, and refuse one more than five minutes old.

import { createHmac, timingSafeEqual } from "node:crypto";

// body is the raw request body, exactly as received. header is the Recvd-Signature header.
export function verify(body, header, secret) {
  const parts = Object.fromEntries(header.split(",").map((part) => part.split("=")));
  const expected = createHmac("sha256", secret).update(parts.t + "." + body).digest("hex");
  const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
  return fresh && parts.v1.length === expected.length && timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected));
}

For your tools: the description, and events on request

Everything on this page is also written down for tools, as an OpenAPI 3.1 description at https://recvd.co/openapi.json: every request, what it takes, what it answers and how it fails, and every event. Give it to a tool that reads OpenAPI to browse the API, to check your requests, or to write a client in your own language.

You can also ask for your events, with or without a webhook address. Recvd keeps the events of the last thirty days for your business, and GET /events lists them oldest first, each exactly as a webhook address is sent it. Keep the id of the last one you have and send it as after to get the ones made since. This is how to hear events on a machine that has no public address, such as your own while you build. An event read this way carries no signature: your API key is what says it came from Recvd.

curl "https://recvd.co/api/v1/events?after=evt_3f9a1c2b4d5e6f708192a3b4" \
  -H "Authorization: Bearer rk_..."

An SDK for Python

The recvd package has a method for every request on this page, an idempotency key on every write that takes one, and a check of a webhook's signature (verify_webhook). It uses the standard library only and needs Python 3.9 or later. Use it on your server.

pip install recvd

This sample also uses Anthropic's own package, with its key in the environment.

import os
from anthropic import Anthropic
from recvd import Recvd

recvd = Recvd(os.environ["RECVD_API_KEY"])
sales = recvd.sales.list(reference="user_8231")["data"]

# Count a model call: the tokens its answer reports become a usage event.
metered = recvd.meter(reference="user_8231")
message = metered(lambda: Anthropic().messages.create(model=model, max_tokens=1024, messages=messages))

meter wraps a call to an OpenAI or Anthropic client and sends the tokens its answer reports as usage events, keyed by the answer's own id (and the meter, where there is one), so the same answer counted twice counts once. For a credits account, as here, one token is one credit unless you say otherwise; for a subscription, give it subscription_id and your meters. A streamed answer is counted when it has been read to the end, or with what it has reported by then if you stop early; an OpenAI chat stream reports usage only when you ask for it with stream_options. Only the counts, that id and what you give meter yourself (who used it, a meter, a memo) are sent, never a prompt or an answer, and an error from Recvd never fails your model call.

What it does not do yet

Questions: collin@recvd.co. See how merchant of record works and pricing. Recvd is in pilot and is operated by Levraq LLC. It is a software platform, not a bank, a lender or a collection agency. Payments are processed and held by a licensed payment partner.

Tell us
what you sell.

Say what you sell and who turned you down. We reply within two business days.

Request access