Guide
A successful checkout call is not proof of payment
Creating a checkout and being paid are two separate moments. If your app grants access, ships goods or marks a job complete when the checkout call returns, you will eventually fulfil an order nobody paid for.
5 min read · Last checked
Key points
- A 200 or 201 from the checkout call means checkout started, not that the card was charged.
- A checkout group that has reached SessionCreated, with an invoice still Open, is waiting on the buyer.
- Fulfil on the invoice.paid webhook, after verifying the signature and once per event id.
- If you cannot run a webhook receiver yet, poll the invoice and release the goods only when its status is Paid.
What the checkout call actually does
Starting a cart checkout creates an invoice and, for card payment, a Stripe Checkout session, then returns straight away. At that point the buyer still has to complete the hosted payment step, and Stripe still has to confirm the charge asynchronously.
The states to know
- Pending: the group exists, with no invoice or session yet.
- InvoiceCreated: an invoice exists but no Stripe session yet.
- SessionCreated: the session exists and the buyer has not paid.
- Paid: Stripe confirmed payment, driven by webhook.
- Failed or Cancelled: nothing to fulfil.
- A successful call normally lands on SessionCreated, with the invoice still Open. Treat both as "checkout started".
Pattern 1: fulfil from the invoice.paid webhook
Subscribe an endpoint to invoice.paid. Do the fulfilment work only inside that handler, after you have verified the X-TenaBill-Signature header against the raw body, and only once per X-TenaBill-Event-Id. Delivery is at least once, so duplicates are normal, not an error.
var evt = TenaBillWebhookVerifier.VerifyAndParse(
secret,
request.Headers["X-TenaBill-Signature"],
request.Headers["X-TenaBill-Event"],
request.Headers["X-TenaBill-Event-Id"],
rawBody);
if (evt.AsInvoicePaid() is { } paid)
{
// Skip if paid.InvoiceId was already fulfilled, then release the order.
}Pattern 2: poll the invoice
Without a public receiver, read the invoice with the invoices:read scope and release the goods only when its status is Paid and paidAtUtc is set. Do not poll the checkout call itself: checkout is a one-shot action, and the invoice is the durable status record.
Use both if you can
Webhooks are the primary signal because they arrive without you asking. Polling the invoice makes a good fallback for a delivery you missed while your receiver was down. TenaBill can also redeliver an event from the console, keeping its original event id so your duplicate check still works.
What to know before you rely on this
- Which events carry which fields is defined in the webhooks help page; read it before you map fields.
- The typed readers in the .NET SDK need TenaBill.Sdk 0.4.0 or later.
Questions people ask
Is checkout.session.completed enough to fulfil?
It is an earlier "the session finished" signal. The documented guidance is to do fulfilment work in the invoice.paid handler.
What if my receiver was down when the event fired?
Redeliver it from the console. The redelivery keeps the original event id, so a receiver that skips ids it has handled will not process it twice.