[{"data":1,"prerenderedAt":2142},["ShallowReactive",2],{"versions":3,"nav-guides":8,"nav-ref-v1":86,"guide-\u002Fguides\u002Fwebhooks":618,"guide-around-\u002Fguides\u002Fwebhooks":2137},[4],{"id":5,"label":5,"file":6,"status":7},"v1","cartirra-v1.json","current",[9,14,19,24,29,34,39,44,49,55,60,65,70,75,80],{"path":10,"title":11,"group":11,"order":12,"description":13},"\u002Fguides\u002Fgetting-started","Getting started",1,"What the Cartirra API does, how requests look, and the three things to set up first.",{"path":15,"title":16,"group":11,"order":17,"description":18},"\u002Fguides\u002Fquickstart","Quickstart",2,"Create a checkout session from your server, let the shopper pay, and read the order. About ten minutes, all in test mode.",{"path":20,"title":21,"group":11,"order":22,"description":23},"\u002Fguides\u002Fembed-checkout","Cartirra Popup and Redirect",2.5,"Open the checkout over your own page with one script tag (Cartirra Popup), or send shoppers to Cartirra's checkout page (Cartirra Redirect). Then confirm the order on your server.",{"path":25,"title":26,"group":11,"order":27,"description":28},"\u002Fguides\u002Fad-tracking","Track checkouts in your ads",2.6,"Your Meta, Google and TikTok pixels see every checkout step and purchase, in the browser and from Cartirra's server, counted once.",{"path":30,"title":31,"group":11,"order":32,"description":33},"\u002Fguides\u002Fpay-at-table","Pay at table",2.7,"Tables with QR codes, bills guests pay from their phone (all at once or split), the live board, refunds and the day's reconciliation. An add-on, per store.",{"path":35,"title":36,"group":11,"order":37,"description":38},"\u002Fguides\u002Fwarranties","Warranties",2.8,"Give a warranty with an item at checkout, or add one after the sale. The shopper keeps it in their Cartirra account and is reminded before it ends. Growth and above.",{"path":40,"title":41,"group":11,"order":42,"description":43},"\u002Fguides\u002Fauthentication","Authentication",3,"Secret and public keys, test and live mode, rotating keys without downtime, and keeping them safe.",{"path":45,"title":46,"group":11,"order":47,"description":48},"\u002Fguides\u002Ftest-mode","Test mode",4,"Build and test your integration with test keys. Payments, refunds and payouts are simulated; no real money moves.",{"path":50,"title":51,"group":52,"order":53,"description":54},"\u002Fguides\u002Fpagination","Pagination and filtering","Core concepts",10,"Lists are newest first and use cursors. Ask for up to 100 items a page and follow next_cursor.",{"path":56,"title":57,"group":52,"order":58,"description":59},"\u002Fguides\u002Fidempotency","Idempotency",11,"Retry creates and refunds safely. The same Idempotency-Key always gets the same response, and the action happens once.",{"path":61,"title":62,"group":52,"order":63,"description":64},"\u002Fguides\u002Ferrors","Errors and troubleshooting",12,"One error shape everywhere. Branch on code, show message, and quote request_id when you contact support.",{"path":66,"title":67,"group":52,"order":68,"description":69},"\u002Fguides\u002Frate-limits","Rate limits",13,"Each secret key gets its own request budget. Back off on 429 using Retry-After.",{"path":71,"title":72,"group":52,"order":73,"description":74},"\u002Fguides\u002Fversioning","Versioning",14,"The version is in the path. Within v1 we only add things, and anything removed is announced with Deprecation and Sunset headers first.",{"path":76,"title":77,"group":77,"order":78,"description":79},"\u002Fguides\u002Fwebhooks","Webhooks",20,"Cartirra posts signed events to your endpoint when orders, payments, refunds, payouts and customers change. Verify, deduplicate, answer fast.",{"path":81,"title":82,"group":83,"order":84,"description":85},"\u002Fguides\u002Fchangelog","Changelog","Resources",30,"Changes to the Cartirra API and these docs. Within v1, changes are additive only.",{"title":87,"version":88,"tags":89,"webhooks":536},"Cartirra API","1.0.0",[90,112,136,171,239,313,345,355,369,384,409,432,446,456,481,496,511,526],{"name":91,"slug":92,"description":93,"operations":94},"Checkout sessions","checkout-sessions","Open a checkout for a cart; the shopper pays in Cartirra Popup on your page or through Cartirra Redirect.",[95,101,107],{"operationId":96,"slug":97,"method":98,"path":99,"summary":100,"tag":91},"createCheckoutSession","create-checkout-session","post","\u002Fv1\u002Fcheckout-sessions","Create a checkout session",{"operationId":102,"slug":103,"method":104,"path":105,"summary":106,"tag":91},"getCheckoutSession","get-checkout-session","get","\u002Fv1\u002Fcheckout-sessions\u002F{id}","Retrieve a checkout session",{"operationId":108,"slug":109,"method":98,"path":110,"summary":111,"tag":91},"expireCheckoutSession","expire-checkout-session","\u002Fv1\u002Fcheckout-sessions\u002F{id}\u002Fexpire","Expire a checkout session",{"name":113,"slug":114,"description":115,"operations":116},"Payment links","payment-links","Carts you share as a link (WhatsApp, Instagram, SMS): no code needed.",[117,122,126,131],{"operationId":118,"slug":119,"method":104,"path":120,"summary":121,"tag":113},"listPaymentLinks","list-payment-links","\u002Fv1\u002Fpayment-links","List payment links",{"operationId":123,"slug":124,"method":98,"path":120,"summary":125,"tag":113},"createPaymentLink","create-payment-link","Create a payment link",{"operationId":127,"slug":128,"method":104,"path":129,"summary":130,"tag":113},"getPaymentLink","get-payment-link","\u002Fv1\u002Fpayment-links\u002F{id}","Retrieve a payment link",{"operationId":132,"slug":133,"method":134,"path":129,"summary":135,"tag":113},"updatePaymentLink","update-payment-link","patch","Update a payment link",{"name":137,"slug":138,"description":139,"operations":140},"Tables","tables","Pay at table: your tables and the QR code printed on each.",[141,146,152,157,161,166],{"operationId":142,"slug":143,"method":104,"path":144,"summary":145,"tag":137},"listPayAtTableStores","list-pay-at-table-stores","\u002Fv1\u002Fpay-at-table\u002Fstores","List Pay at table stores",{"operationId":147,"slug":148,"method":149,"path":150,"summary":151,"tag":137},"setStorePayAtTable","set-store-pay-at-table","put","\u002Fv1\u002Fstores\u002F{store_id}\u002Fpay-at-table","Turn Pay at table on or off at a store",{"operationId":153,"slug":154,"method":104,"path":155,"summary":156,"tag":137},"listTables","list-tables","\u002Fv1\u002Fstores\u002F{store_id}\u002Ftables","List tables",{"operationId":158,"slug":159,"method":98,"path":155,"summary":160,"tag":137},"createTables","create-tables","Add tables",{"operationId":162,"slug":163,"method":134,"path":164,"summary":165,"tag":137},"updateTable","update-table","\u002Fv1\u002Ftables\u002F{id}","Update a table",{"operationId":167,"slug":168,"method":98,"path":169,"summary":170,"tag":137},"rotateTableQr","rotate-table-qr","\u002Fv1\u002Ftables\u002F{id}\u002Frotate-qr","Replace a table’s QR link",{"name":172,"slug":173,"description":174,"operations":175},"Bills","bills","Pay at table: bills guests pay from the table QR (all at once or split), the live board, refunds and the day’s reconciliation.",[176,181,185,190,195,200,205,210,215,220,224,229,234],{"operationId":177,"slug":178,"method":104,"path":179,"summary":180,"tag":172},"listBills","list-bills","\u002Fv1\u002Fbills","List bills",{"operationId":182,"slug":183,"method":98,"path":179,"summary":184,"tag":172},"openBill","open-bill","Open a bill",{"operationId":186,"slug":187,"method":104,"path":188,"summary":189,"tag":172},"getBillBoard","get-bill-board","\u002Fv1\u002Fbills\u002Fboard","Retrieve the table board",{"operationId":191,"slug":192,"method":104,"path":193,"summary":194,"tag":172},"lookupBillPayments","lookup-bill-payments","\u002Fv1\u002Fbills\u002Fpayments","Find a table payment",{"operationId":196,"slug":197,"method":104,"path":198,"summary":199,"tag":172},"getBillReconciliation","get-bill-reconciliation","\u002Fv1\u002Fbills\u002Freconciliation","Retrieve the day’s reconciliation",{"operationId":201,"slug":202,"method":104,"path":203,"summary":204,"tag":172},"listBillRefunds","list-bill-refunds","\u002Fv1\u002Fbills\u002Frefunds","List the refund queue",{"operationId":206,"slug":207,"method":98,"path":208,"summary":209,"tag":172},"refundBillRefund","refund-bill-refund","\u002Fv1\u002Fbills\u002Frefunds\u002F{id}\u002Frefund","Send a queued refund",{"operationId":211,"slug":212,"method":98,"path":213,"summary":214,"tag":172},"dismissBillRefund","dismiss-bill-refund","\u002Fv1\u002Fbills\u002Frefunds\u002F{id}\u002Fdismiss","Dismiss a queued refund",{"operationId":216,"slug":217,"method":104,"path":218,"summary":219,"tag":172},"getBill","get-bill","\u002Fv1\u002Fbills\u002F{id}","Retrieve a bill",{"operationId":221,"slug":222,"method":134,"path":218,"summary":223,"tag":172},"updateBill","update-bill","Update a bill",{"operationId":225,"slug":226,"method":98,"path":227,"summary":228,"tag":172},"recordBillOutsidePayment","record-bill-outside-payment","\u002Fv1\u002Fbills\u002F{id}\u002Foutside","Record a payment outside Cartirra",{"operationId":230,"slug":231,"method":98,"path":232,"summary":233,"tag":172},"closeBill","close-bill","\u002Fv1\u002Fbills\u002F{id}\u002Fclose","Close a bill",{"operationId":235,"slug":236,"method":98,"path":237,"summary":238,"tag":172},"voidBill","void-bill","\u002Fv1\u002Fbills\u002F{id}\u002Fvoid","Void a bill",{"name":240,"slug":241,"description":242,"operations":243},"Orders","orders","Orders placed through checkout: read them and move them through fulfilment, and answer problems shoppers report.",[244,249,254,259,264,269,274,279,284,289,294,298,303,308],{"operationId":245,"slug":246,"method":104,"path":247,"summary":248,"tag":240},"getOrderRelated","get-order-related","\u002Fv1\u002Forders\u002F{id}\u002Frelated","Retrieve order extras",{"operationId":250,"slug":251,"method":104,"path":252,"summary":253,"tag":240},"listOrders","list-orders","\u002Fv1\u002Forders","List orders",{"operationId":255,"slug":256,"method":104,"path":257,"summary":258,"tag":240},"getOrder","get-order","\u002Fv1\u002Forders\u002F{id}","Retrieve an order",{"operationId":260,"slug":261,"method":104,"path":262,"summary":263,"tag":240},"listOrderActivity","list-order-activity","\u002Fv1\u002Forders\u002F{id}\u002Factivity","List order activity",{"operationId":265,"slug":266,"method":98,"path":267,"summary":268,"tag":240},"updateOrderStatus","update-order-status","\u002Fv1\u002Forders\u002F{id}\u002Fstatus","Update order status",{"operationId":270,"slug":271,"method":98,"path":272,"summary":273,"tag":240},"acceptOrder","accept-order","\u002Fv1\u002Forders\u002F{id}\u002Faccept","Accept an order",{"operationId":275,"slug":276,"method":149,"path":277,"summary":278,"tag":240},"updateOrderDeliveryAddress","update-order-delivery-address","\u002Fv1\u002Forders\u002F{id}\u002Fdelivery-address","Update delivery address",{"operationId":280,"slug":281,"method":98,"path":282,"summary":283,"tag":240},"cancelOrder","cancel-order","\u002Fv1\u002Forders\u002F{id}\u002Fcancel","Cancel an order",{"operationId":285,"slug":286,"method":104,"path":287,"summary":288,"tag":240},"listOrderIssues","list-order-issues","\u002Fv1\u002Forder-issues","List problem reports",{"operationId":290,"slug":291,"method":104,"path":292,"summary":293,"tag":240},"getOrderIssue","get-order-issue","\u002Fv1\u002Forder-issues\u002F{id}","Retrieve a problem report",{"operationId":295,"slug":296,"method":134,"path":292,"summary":297,"tag":240},"updateOrderIssue","update-order-issue","Update a problem report",{"operationId":299,"slug":300,"method":98,"path":301,"summary":302,"tag":240},"markPayOnDeliveryCollected","mark-pay-on-delivery-collected","\u002Fv1\u002Forders\u002F{id}\u002Fpay-on-delivery\u002Fcollected","Mark pay on delivery collected",{"operationId":304,"slug":305,"method":98,"path":306,"summary":307,"tag":240},"markPayOnDeliveryNotPaid","mark-pay-on-delivery-not-paid","\u002Fv1\u002Forders\u002F{id}\u002Fpay-on-delivery\u002Fnot-paid","Mark pay on delivery not paid",{"operationId":309,"slug":310,"method":98,"path":311,"summary":312,"tag":240},"rejectOrder","reject-order","\u002Fv1\u002Forders\u002F{id}\u002Freject","Reject an order",{"name":36,"slug":314,"description":315,"operations":316},"warranties","Warranties on what you sold: sent on checkout lines or added afterwards. Shoppers keep them in their Cartirra account.",[317,322,327,331,336,341],{"operationId":318,"slug":319,"method":104,"path":320,"summary":321,"tag":36},"listWarranties","list-warranties","\u002Fv1\u002Fwarranties","List warranties",{"operationId":323,"slug":324,"method":104,"path":325,"summary":326,"tag":36},"getWarranty","get-warranty","\u002Fv1\u002Fwarranties\u002F{id}","Retrieve a warranty",{"operationId":328,"slug":329,"method":134,"path":325,"summary":330,"tag":36},"updateWarranty","update-warranty","Update a warranty",{"operationId":332,"slug":333,"method":98,"path":334,"summary":335,"tag":36},"voidWarranty","void-warranty","\u002Fv1\u002Fwarranties\u002F{id}\u002Fvoid","Void a warranty",{"operationId":337,"slug":338,"method":104,"path":339,"summary":340,"tag":36},"listOrderWarranties","list-order-warranties","\u002Fv1\u002Forders\u002F{id}\u002Fwarranties","List an order's warranties",{"operationId":342,"slug":343,"method":98,"path":339,"summary":344,"tag":36},"createWarranty","create-warranty","Add a warranty to an order",{"name":346,"slug":347,"description":348,"operations":349},"Payments","payments","The payment behind an order (bank transfer or card).",[350],{"operationId":351,"slug":352,"method":104,"path":353,"summary":354,"tag":346},"getPayment","get-payment","\u002Fv1\u002Fpayments\u002F{id}","Retrieve a payment",{"name":356,"slug":357,"description":358,"operations":359},"Refunds","refunds","Return money to the shopper, in full or in part.",[360,365],{"operationId":361,"slug":362,"method":104,"path":363,"summary":364,"tag":356},"listRefunds","list-refunds","\u002Fv1\u002Forders\u002F{id}\u002Frefunds","List refunds",{"operationId":366,"slug":367,"method":98,"path":363,"summary":368,"tag":356},"createRefund","create-refund","Create a refund",{"name":370,"slug":371,"description":372,"operations":373},"Receipts","receipts","Receipts and credit notes issued for orders.",[374,379],{"operationId":375,"slug":376,"method":104,"path":377,"summary":378,"tag":370},"getOrderReceipt","get-order-receipt","\u002Fv1\u002Forders\u002F{id}\u002Freceipt","Retrieve a receipt",{"operationId":380,"slug":381,"method":104,"path":382,"summary":383,"tag":370},"listOrderCreditNotes","list-order-credit-notes","\u002Fv1\u002Forders\u002F{id}\u002Fcredit-notes","List credit notes",{"name":385,"slug":386,"description":387,"operations":388},"Customers","customers","Shoppers who shared their details with your business.",[389,394,399,404],{"operationId":390,"slug":391,"method":104,"path":392,"summary":393,"tag":385},"listCustomerActivity","list-customer-activity","\u002Fv1\u002Fcustomers\u002F{id}\u002Factivity","List customer activity",{"operationId":395,"slug":396,"method":104,"path":397,"summary":398,"tag":385},"listCustomerAddresses","list-customer-addresses","\u002Fv1\u002Fcustomers\u002F{id}\u002Faddresses","List customer addresses",{"operationId":400,"slug":401,"method":104,"path":402,"summary":403,"tag":385},"listCustomers","list-customers","\u002Fv1\u002Fcustomers","List customers",{"operationId":405,"slug":406,"method":104,"path":407,"summary":408,"tag":385},"getCustomer","get-customer","\u002Fv1\u002Fcustomers\u002F{id}","Retrieve a customer",{"name":410,"slug":411,"description":412,"operations":413},"Promotions","promotions","Discount codes and automatic promotions.",[414,419,423,428],{"operationId":415,"slug":416,"method":104,"path":417,"summary":418,"tag":410},"listPromotions","list-promotions","\u002Fv1\u002Fpromotions","List promotions",{"operationId":420,"slug":421,"method":98,"path":417,"summary":422,"tag":410},"createPromotion","create-promotion","Create a promotion",{"operationId":424,"slug":425,"method":104,"path":426,"summary":427,"tag":410},"getPromotion","get-promotion","\u002Fv1\u002Fpromotions\u002F{id}","Retrieve a promotion",{"operationId":429,"slug":430,"method":134,"path":426,"summary":431,"tag":410},"updatePromotion","update-promotion","Update a promotion",{"name":433,"slug":434,"description":435,"operations":436},"Gift cards","gift-cards","Issue and list gift cards.",[437,442],{"operationId":438,"slug":439,"method":104,"path":440,"summary":441,"tag":433},"listGiftCards","list-gift-cards","\u002Fv1\u002Fgift-cards","List gift cards",{"operationId":443,"slug":444,"method":98,"path":440,"summary":445,"tag":433},"createGiftCard","create-gift-card","Issue a gift card",{"name":447,"slug":448,"description":449,"operations":450},"Reviews","reviews","Ratings shoppers left on completed orders.",[451],{"operationId":452,"slug":453,"method":104,"path":454,"summary":455,"tag":447},"listReviews","list-reviews","\u002Fv1\u002Freviews","List reviews",{"name":457,"slug":458,"description":459,"operations":460},"Balance","balance","Your Cartirra balance and its movements.",[461,466,471,476],{"operationId":462,"slug":463,"method":104,"path":464,"summary":465,"tag":457},"getBalance","get-balance","\u002Fv1\u002Fbalance","Retrieve balance",{"operationId":467,"slug":468,"method":104,"path":469,"summary":470,"tag":457},"listBalanceTransactions","list-balance-transactions","\u002Fv1\u002Fbalance\u002Ftransactions","List balance transactions",{"operationId":472,"slug":473,"method":104,"path":474,"summary":475,"tag":457},"getBalanceTransaction","get-balance-transaction","\u002Fv1\u002Fbalance\u002Ftransactions\u002F{id}","Retrieve a balance transaction",{"operationId":477,"slug":478,"method":104,"path":479,"summary":480,"tag":457},"getDeposit","get-deposit","\u002Fv1\u002Fbalance\u002Fdeposits\u002F{id}","Retrieve a deposit",{"name":482,"slug":483,"description":484,"operations":485},"Payouts","payouts","Money sent from your balance to your bank account.",[486,491],{"operationId":487,"slug":488,"method":104,"path":489,"summary":490,"tag":482},"listPayouts","list-payouts","\u002Fv1\u002Fpayouts","List payouts",{"operationId":492,"slug":493,"method":104,"path":494,"summary":495,"tag":482},"getPayout","get-payout","\u002Fv1\u002Fpayouts\u002F{id}","Retrieve a payout",{"name":497,"slug":498,"description":499,"operations":500},"Stores","stores","Your business's stores.",[501,506],{"operationId":502,"slug":503,"method":104,"path":504,"summary":505,"tag":497},"listStores","list-stores","\u002Fv1\u002Fstores","List stores",{"operationId":507,"slug":508,"method":104,"path":509,"summary":510,"tag":497},"getStore","get-store","\u002Fv1\u002Fstores\u002F{store_id}","Retrieve a store",{"name":512,"slug":513,"description":514,"operations":515},"Events","events","Everything Cartirra sent (or would send) to your webhook endpoint.",[516,521],{"operationId":517,"slug":518,"method":104,"path":519,"summary":520,"tag":512},"listEvents","list-events","\u002Fv1\u002Fevents","List events",{"operationId":522,"slug":523,"method":104,"path":524,"summary":525,"tag":512},"getEvent","get-event","\u002Fv1\u002Fevents\u002F{id}","Retrieve an event",{"name":527,"slug":528,"description":529,"operations":530},"Account","account","The business and mode your key belongs to.",[531],{"operationId":532,"slug":533,"method":104,"path":534,"summary":535,"tag":527},"getContext","get-context","\u002Fv1\u002Fme\u002Fcontext","Retrieve key context",[537,540,543,546,549,552,555,558,561,564,567,570,573,576,579,582,585,588,591,594,597,600,603,606,609,612,615],{"event":538,"slug":539,"summary":538},"order.created","order-created",{"event":541,"slug":542,"summary":541},"order.updated","order-updated",{"event":544,"slug":545,"summary":544},"payment.succeeded","payment-succeeded",{"event":547,"slug":548,"summary":547},"payment.failed","payment-failed",{"event":550,"slug":551,"summary":550},"payment.expired","payment-expired",{"event":553,"slug":554,"summary":553},"refund.succeeded","refund-succeeded",{"event":556,"slug":557,"summary":556},"refund.failed","refund-failed",{"event":559,"slug":560,"summary":559},"payout.paid","payout-paid",{"event":562,"slug":563,"summary":562},"payout.failed","payout-failed",{"event":565,"slug":566,"summary":565},"webhook.test","webhook-test",{"event":568,"slug":569,"summary":568},"customer.created","customer-created",{"event":571,"slug":572,"summary":571},"customer.updated","customer-updated",{"event":574,"slug":575,"summary":574},"bill.opened","bill-opened",{"event":577,"slug":578,"summary":577},"bill.updated","bill-updated",{"event":580,"slug":581,"summary":580},"bill.payment_received","bill-payment-received",{"event":583,"slug":584,"summary":583},"bill.closed","bill-closed",{"event":586,"slug":587,"summary":586},"bill.voided","bill-voided",{"event":589,"slug":590,"summary":589},"customer.consent_revoked","customer-consent-revoked",{"event":592,"slug":593,"summary":592},"order.issue_reported","order-issue-reported",{"event":595,"slug":596,"summary":595},"order.issue_updated","order-issue-updated",{"event":598,"slug":599,"summary":598},"warranty.created","warranty-created",{"event":601,"slug":602,"summary":601},"warranty.updated","warranty-updated",{"event":604,"slug":605,"summary":604},"warranty.voided","warranty-voided",{"event":607,"slug":608,"summary":607},"order.accepted","order-accepted",{"event":610,"slug":611,"summary":610},"order.rejected","order-rejected",{"event":613,"slug":614,"summary":613},"loyalty.tier_changed","loyalty-tier-changed",{"event":616,"slug":617,"summary":616},"loyalty.reward_redeemed","loyalty-reward-redeemed",{"id":619,"title":77,"body":620,"description":79,"extension":2132,"group":77,"meta":2133,"navigation":1237,"order":78,"path":76,"seo":2134,"stem":2135,"__hash__":2136},"guides\u002Fguides\u002Fwebhooks.md",{"type":621,"value":622,"toc":2122},"minimark",[623,637,640,941,945,952,1013,1138,1144,1148,1159,1194,1743,2019,2023,2034,2038,2049,2053,2079,2083,2093,2097,2118],[624,625,626,627,631,632,636],"p",{},"Instead of polling, let Cartirra tell your server when something happens. Add an endpoint under ",[628,629,630],"strong",{},"Developers → Webhooks"," in the dashboard. Each mode (test and live) has one endpoint and its own signing secret (",[633,634,635],"code",{},"whsec_…",").",[638,639,512],"h2",{"id":513},[641,642,643,656],"table",{},[644,645,646],"thead",{},[647,648,649,653],"tr",{},[650,651,652],"th",{},"Event",[650,654,655],{},"Sent when",[657,658,659,673,685,697,709,721,733,745,757,769,781,793,805,817,829,841,853,865,877,889,901,913,925],"tbody",{},[647,660,661,670],{},[662,663,664],"td",{},[665,666,668],"a",{"href":667},"\u002Freference\u002Fwebhooks\u002Forder-created",[633,669,538],{},[662,671,672],{},"An order is placed (its payment succeeded)",[647,674,675,682],{},[662,676,677],{},[665,678,680],{"href":679},"\u002Freference\u002Fwebhooks\u002Forder-updated",[633,681,541],{},[662,683,684],{},"An order's status, payment status or details change",[647,686,687,694],{},[662,688,689],{},[665,690,692],{"href":691},"\u002Freference\u002Fwebhooks\u002Fpayment-succeeded",[633,693,544],{},[662,695,696],{},"A payment completes",[647,698,699,706],{},[662,700,701],{},[665,702,704],{"href":703},"\u002Freference\u002Fwebhooks\u002Fpayment-failed",[633,705,547],{},[662,707,708],{},"A payment fails",[647,710,711,718],{},[662,712,713],{},[665,714,716],{"href":715},"\u002Freference\u002Fwebhooks\u002Fpayment-expired",[633,717,550],{},[662,719,720],{},"A payment window closes unpaid",[647,722,723,730],{},[662,724,725],{},[665,726,728],{"href":727},"\u002Freference\u002Fwebhooks\u002Frefund-succeeded",[633,729,553],{},[662,731,732],{},"A refund reaches the shopper",[647,734,735,742],{},[662,736,737],{},[665,738,740],{"href":739},"\u002Freference\u002Fwebhooks\u002Frefund-failed",[633,741,556],{},[662,743,744],{},"A refund can't be completed",[647,746,747,754],{},[662,748,749],{},[665,750,752],{"href":751},"\u002Freference\u002Fwebhooks\u002Fpayout-paid",[633,753,559],{},[662,755,756],{},"A payout lands in your bank account",[647,758,759,766],{},[662,760,761],{},[665,762,764],{"href":763},"\u002Freference\u002Fwebhooks\u002Fpayout-failed",[633,765,562],{},[662,767,768],{},"A payout fails and the money returns to your balance",[647,770,771,778],{},[662,772,773],{},[665,774,776],{"href":775},"\u002Freference\u002Fwebhooks\u002Fcustomer-created",[633,777,568],{},[662,779,780],{},"A shopper agrees to share their details with you, or a guest places their first order",[647,782,783,790],{},[662,784,785],{},[665,786,788],{"href":787},"\u002Freference\u002Fwebhooks\u002Fcustomer-updated",[633,789,571],{},[662,791,792],{},"A shopper's shared name, email or phone changes",[647,794,795,802],{},[662,796,797],{},[665,798,800],{"href":799},"\u002Freference\u002Fwebhooks\u002Fcustomer-consent-revoked",[633,801,589],{},[662,803,804],{},"A shopper stops sharing their details with you: delete any copies of their email and phone you keep",[647,806,807,814],{},[662,808,809],{},[665,810,812],{"href":811},"\u002Freference\u002Fwebhooks\u002Fbill-opened",[633,813,574],{},[662,815,816],{},"Pay at table: a bill is opened for a table",[647,818,819,826],{},[662,820,821],{},[665,822,824],{"href":823},"\u002Freference\u002Fwebhooks\u002Fbill-updated",[633,825,577],{},[662,827,828],{},"A bill's total, split or note changes, or money paid outside Cartirra is recorded",[647,830,831,838],{},[662,832,833],{},[665,834,836],{"href":835},"\u002Freference\u002Fwebhooks\u002Fbill-payment-received",[633,837,580],{},[662,839,840],{},"A guest's payment toward a bill arrives",[647,842,843,850],{},[662,844,845],{},[665,846,848],{"href":847},"\u002Freference\u002Fwebhooks\u002Fbill-closed",[633,849,583],{},[662,851,852],{},"A bill is fully paid, or a manager closes it",[647,854,855,862],{},[662,856,857],{},[665,858,860],{"href":859},"\u002Freference\u002Fwebhooks\u002Fbill-voided",[633,861,586],{},[662,863,864],{},"A bill is voided",[647,866,867,874],{},[662,868,869],{},[665,870,872],{"href":871},"\u002Freference\u002Fwebhooks\u002Forder-issue-reported",[633,873,592],{},[662,875,876],{},"A shopper reports a problem with an order",[647,878,879,886],{},[662,880,881],{},[665,882,884],{"href":883},"\u002Freference\u002Fwebhooks\u002Forder-issue-updated",[633,885,595],{},[662,887,888],{},"A problem report is reviewed, resolved, rejected or withdrawn, or a refund is linked to it",[647,890,891,898],{},[662,892,893],{},[665,894,896],{"href":895},"\u002Freference\u002Fwebhooks\u002Fwarranty-created",[633,897,598],{},[662,899,900],{},"A warranty is created: from a checkout line when the order is paid, or added afterwards",[647,902,903,910],{},[662,904,905],{},[665,906,908],{"href":907},"\u002Freference\u002Fwebhooks\u002Fwarranty-updated",[633,909,601],{},[662,911,912],{},"A warranty's serial number, dates or terms change",[647,914,915,922],{},[662,916,917],{},[665,918,920],{"href":919},"\u002Freference\u002Fwebhooks\u002Fwarranty-voided",[633,921,604],{},[662,923,924],{},"A warranty is voided",[647,926,927,934],{},[662,928,929],{},[665,930,932],{"href":931},"\u002Freference\u002Fwebhooks\u002Fwebhook-test",[633,933,565],{},[662,935,936,937,940],{},"You press ",[628,938,939],{},"Send test event"," in the dashboard",[638,942,944],{"id":943},"the-request","The request",[624,946,947,948,951],{},"Cartirra sends a ",[633,949,950],{},"POST"," with a JSON body and these headers:",[641,953,954,964],{},[644,955,956],{},[647,957,958,961],{},[650,959,960],{},"Header",[650,962,963],{},"Value",[657,965,966,978,991,1003],{},[647,967,968,973],{},[662,969,970],{},[633,971,972],{},"Cartirra-Signature",[662,974,975],{},[633,976,977],{},"t=\u003Cunix seconds>,v1=\u003Chex HMAC-SHA256>",[647,979,980,985],{},[662,981,982],{},[633,983,984],{},"Cartirra-Event-Id",[662,986,987,988],{},"The event id, ",[633,989,990],{},"evt_…",[647,992,993,998],{},[662,994,995],{},[633,996,997],{},"Cartirra-Event-Type",[662,999,1000,1001],{},"For example ",[633,1002,538],{},[647,1004,1005,1010],{},[662,1006,1007],{},[633,1008,1009],{},"Cartirra-Delivery-Id",[662,1011,1012],{},"This delivery (an event is delivered once per endpoint)",[1014,1015,1020],"pre",{"className":1016,"code":1017,"language":1018,"meta":1019,"style":1019},"language-json shiki shiki-themes github-light github-dark","{\n  \"id\": \"evt_0193a1b2c3d47e5f8a9b0c1d2e3f4a5b\",\n  \"object\": \"event\",\n  \"type\": \"order.created\",\n  \"livemode\": false,\n  \"created\": \"2026-10-24T09:30:00.000Z\",\n  \"data\": { \"object\": { \"id\": \"ord_0193a1b2c3d47e5f8a9b0c1d2e3f4a5b\", \"reference\": \"ORD-1042\" } }\n}\n","json","",[633,1021,1022,1030,1046,1058,1070,1083,1096,1132],{"__ignoreMap":1019},[1023,1024,1026],"span",{"class":1025,"line":12},"line",[1023,1027,1029],{"class":1028},"sVt8B","{\n",[1023,1031,1032,1036,1039,1043],{"class":1025,"line":17},[1023,1033,1035],{"class":1034},"sj4cs","  \"id\"",[1023,1037,1038],{"class":1028},": ",[1023,1040,1042],{"class":1041},"sZZnC","\"evt_0193a1b2c3d47e5f8a9b0c1d2e3f4a5b\"",[1023,1044,1045],{"class":1028},",\n",[1023,1047,1048,1051,1053,1056],{"class":1025,"line":42},[1023,1049,1050],{"class":1034},"  \"object\"",[1023,1052,1038],{"class":1028},[1023,1054,1055],{"class":1041},"\"event\"",[1023,1057,1045],{"class":1028},[1023,1059,1060,1063,1065,1068],{"class":1025,"line":47},[1023,1061,1062],{"class":1034},"  \"type\"",[1023,1064,1038],{"class":1028},[1023,1066,1067],{"class":1041},"\"order.created\"",[1023,1069,1045],{"class":1028},[1023,1071,1073,1076,1078,1081],{"class":1025,"line":1072},5,[1023,1074,1075],{"class":1034},"  \"livemode\"",[1023,1077,1038],{"class":1028},[1023,1079,1080],{"class":1034},"false",[1023,1082,1045],{"class":1028},[1023,1084,1086,1089,1091,1094],{"class":1025,"line":1085},6,[1023,1087,1088],{"class":1034},"  \"created\"",[1023,1090,1038],{"class":1028},[1023,1092,1093],{"class":1041},"\"2026-10-24T09:30:00.000Z\"",[1023,1095,1045],{"class":1028},[1023,1097,1099,1102,1105,1108,1110,1113,1115,1118,1121,1124,1126,1129],{"class":1025,"line":1098},7,[1023,1100,1101],{"class":1034},"  \"data\"",[1023,1103,1104],{"class":1028},": { ",[1023,1106,1107],{"class":1034},"\"object\"",[1023,1109,1104],{"class":1028},[1023,1111,1112],{"class":1034},"\"id\"",[1023,1114,1038],{"class":1028},[1023,1116,1117],{"class":1041},"\"ord_0193a1b2c3d47e5f8a9b0c1d2e3f4a5b\"",[1023,1119,1120],{"class":1028},", ",[1023,1122,1123],{"class":1034},"\"reference\"",[1023,1125,1038],{"class":1028},[1023,1127,1128],{"class":1041},"\"ORD-1042\"",[1023,1130,1131],{"class":1028}," } }\n",[1023,1133,1135],{"class":1025,"line":1134},8,[1023,1136,1137],{"class":1028},"}\n",[624,1139,1140,1143],{},[633,1141,1142],{},"data.object"," is the resource as it was when the event happened. Each event's page in the reference shows its full payload.",[638,1145,1147],{"id":1146},"verify-the-signature","Verify the signature",[624,1149,1150,1151,1154,1155,1158],{},"Always verify before trusting a webhook. The signature is an HMAC-SHA256, keyed with your endpoint's ",[633,1152,1153],{},"whsec_"," secret, of the string ",[633,1156,1157],{},"\u003Ct>.\u003Craw request body>",".",[1160,1161,1162,1170,1182,1188],"ol",{},[1163,1164,1165,1166,1169],"li",{},"Read the ",[628,1167,1168],{},"raw"," body exactly as received. Parsing and re-serialising the JSON changes it and breaks the signature.",[1163,1171,1172,1173,1175,1176,1179,1180,1158],{},"Split ",[633,1174,972],{}," into ",[633,1177,1178],{},"t"," and ",[633,1181,5],{},[1163,1183,1184,1185,1187],{},"Reject the request if ",[633,1186,1178],{}," is more than 5 minutes from now (replay protection).",[1163,1189,1190,1191,1193],{},"Compute the HMAC and compare it with ",[633,1192,5],{}," in constant time.",[1014,1195,1199],{"className":1196,"code":1197,"language":1198,"meta":1019,"style":1019},"language-javascript shiki shiki-themes github-light github-dark","import crypto from 'node:crypto';\nimport express from 'express';\n\nconst app = express();\nconst secret = process.env.CARTIRRA_WEBHOOK_SECRET; \u002F\u002F whsec_…\n\nfunction verify(rawBody, header, toleranceSeconds = 300) {\n  const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));\n  const timestamp = Number(parts.t);\n  if (!timestamp || Math.abs(Date.now() \u002F 1000 - timestamp) > toleranceSeconds) return false;\n  const expected = crypto.createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex');\n  const given = Buffer.from(parts.v1 ?? '', 'hex');\n  return given.length === 32 && crypto.timingSafeEqual(given, Buffer.from(expected, 'hex'));\n}\n\napp.post('\u002Fwebhooks\u002Fcartirra', express.raw({ type: 'application\u002Fjson' }), (req, res) => {\n  if (!verify(req.body.toString('utf8'), req.get('Cartirra-Signature') ?? '')) return res.sendStatus(400);\n  const event = JSON.parse(req.body.toString('utf8'));\n  res.sendStatus(200); \u002F\u002F answer first, then do the work\n  queue.add(event); \u002F\u002F e.g. fulfil the order in a background job\n});\n","javascript",[633,1200,1201,1219,1233,1239,1257,1279,1283,1316,1372,1388,1446,1501,1530,1568,1572,1577,1619,1676,1704,1723,1737],{"__ignoreMap":1019},[1023,1202,1203,1207,1210,1213,1216],{"class":1025,"line":12},[1023,1204,1206],{"class":1205},"szBVR","import",[1023,1208,1209],{"class":1028}," crypto ",[1023,1211,1212],{"class":1205},"from",[1023,1214,1215],{"class":1041}," 'node:crypto'",[1023,1217,1218],{"class":1028},";\n",[1023,1220,1221,1223,1226,1228,1231],{"class":1025,"line":17},[1023,1222,1206],{"class":1205},[1023,1224,1225],{"class":1028}," express ",[1023,1227,1212],{"class":1205},[1023,1229,1230],{"class":1041}," 'express'",[1023,1232,1218],{"class":1028},[1023,1234,1235],{"class":1025,"line":42},[1023,1236,1238],{"emptyLinePlaceholder":1237},true,"\n",[1023,1240,1241,1244,1247,1250,1254],{"class":1025,"line":47},[1023,1242,1243],{"class":1205},"const",[1023,1245,1246],{"class":1034}," app",[1023,1248,1249],{"class":1205}," =",[1023,1251,1253],{"class":1252},"sScJk"," express",[1023,1255,1256],{"class":1028},"();\n",[1023,1258,1259,1261,1264,1266,1269,1272,1275],{"class":1025,"line":1072},[1023,1260,1243],{"class":1205},[1023,1262,1263],{"class":1034}," secret",[1023,1265,1249],{"class":1205},[1023,1267,1268],{"class":1028}," process.env.",[1023,1270,1271],{"class":1034},"CARTIRRA_WEBHOOK_SECRET",[1023,1273,1274],{"class":1028},"; ",[1023,1276,1278],{"class":1277},"sJ8bj","\u002F\u002F whsec_…\n",[1023,1280,1281],{"class":1025,"line":1085},[1023,1282,1238],{"emptyLinePlaceholder":1237},[1023,1284,1285,1288,1291,1294,1298,1300,1303,1305,1308,1310,1313],{"class":1025,"line":1098},[1023,1286,1287],{"class":1205},"function",[1023,1289,1290],{"class":1252}," verify",[1023,1292,1293],{"class":1028},"(",[1023,1295,1297],{"class":1296},"s4XuR","rawBody",[1023,1299,1120],{"class":1028},[1023,1301,1302],{"class":1296},"header",[1023,1304,1120],{"class":1028},[1023,1306,1307],{"class":1296},"toleranceSeconds",[1023,1309,1249],{"class":1205},[1023,1311,1312],{"class":1034}," 300",[1023,1314,1315],{"class":1028},") {\n",[1023,1317,1318,1321,1324,1326,1329,1332,1335,1338,1340,1343,1345,1348,1351,1353,1356,1359,1362,1364,1366,1369],{"class":1025,"line":1134},[1023,1319,1320],{"class":1205},"  const",[1023,1322,1323],{"class":1034}," parts",[1023,1325,1249],{"class":1205},[1023,1327,1328],{"class":1028}," Object.",[1023,1330,1331],{"class":1252},"fromEntries",[1023,1333,1334],{"class":1028},"(header.",[1023,1336,1337],{"class":1252},"split",[1023,1339,1293],{"class":1028},[1023,1341,1342],{"class":1041},"','",[1023,1344,636],{"class":1028},[1023,1346,1347],{"class":1252},"map",[1023,1349,1350],{"class":1028},"((",[1023,1352,624],{"class":1296},[1023,1354,1355],{"class":1028},") ",[1023,1357,1358],{"class":1205},"=>",[1023,1360,1361],{"class":1028}," p.",[1023,1363,1337],{"class":1252},[1023,1365,1293],{"class":1028},[1023,1367,1368],{"class":1041},"'='",[1023,1370,1371],{"class":1028},")));\n",[1023,1373,1375,1377,1380,1382,1385],{"class":1025,"line":1374},9,[1023,1376,1320],{"class":1205},[1023,1378,1379],{"class":1034}," timestamp",[1023,1381,1249],{"class":1205},[1023,1383,1384],{"class":1252}," Number",[1023,1386,1387],{"class":1028},"(parts.t);\n",[1023,1389,1390,1393,1396,1399,1402,1405,1408,1411,1414,1417,1420,1423,1426,1429,1432,1435,1438,1441,1444],{"class":1025,"line":53},[1023,1391,1392],{"class":1205},"  if",[1023,1394,1395],{"class":1028}," (",[1023,1397,1398],{"class":1205},"!",[1023,1400,1401],{"class":1028},"timestamp ",[1023,1403,1404],{"class":1205},"||",[1023,1406,1407],{"class":1028}," Math.",[1023,1409,1410],{"class":1252},"abs",[1023,1412,1413],{"class":1028},"(Date.",[1023,1415,1416],{"class":1252},"now",[1023,1418,1419],{"class":1028},"() ",[1023,1421,1422],{"class":1205},"\u002F",[1023,1424,1425],{"class":1034}," 1000",[1023,1427,1428],{"class":1205}," -",[1023,1430,1431],{"class":1028}," timestamp) ",[1023,1433,1434],{"class":1205},">",[1023,1436,1437],{"class":1028}," toleranceSeconds) ",[1023,1439,1440],{"class":1205},"return",[1023,1442,1443],{"class":1034}," false",[1023,1445,1218],{"class":1028},[1023,1447,1448,1450,1453,1455,1458,1461,1463,1466,1469,1472,1474,1477,1480,1483,1485,1488,1490,1493,1495,1498],{"class":1025,"line":58},[1023,1449,1320],{"class":1205},[1023,1451,1452],{"class":1034}," expected",[1023,1454,1249],{"class":1205},[1023,1456,1457],{"class":1028}," crypto.",[1023,1459,1460],{"class":1252},"createHmac",[1023,1462,1293],{"class":1028},[1023,1464,1465],{"class":1041},"'sha256'",[1023,1467,1468],{"class":1028},", secret).",[1023,1470,1471],{"class":1252},"update",[1023,1473,1293],{"class":1028},[1023,1475,1476],{"class":1041},"`${",[1023,1478,1479],{"class":1028},"timestamp",[1023,1481,1482],{"class":1041},"}.${",[1023,1484,1297],{"class":1028},[1023,1486,1487],{"class":1041},"}`",[1023,1489,636],{"class":1028},[1023,1491,1492],{"class":1252},"digest",[1023,1494,1293],{"class":1028},[1023,1496,1497],{"class":1041},"'hex'",[1023,1499,1500],{"class":1028},");\n",[1023,1502,1503,1505,1508,1510,1513,1515,1518,1521,1524,1526,1528],{"class":1025,"line":63},[1023,1504,1320],{"class":1205},[1023,1506,1507],{"class":1034}," given",[1023,1509,1249],{"class":1205},[1023,1511,1512],{"class":1028}," Buffer.",[1023,1514,1212],{"class":1252},[1023,1516,1517],{"class":1028},"(parts.v1 ",[1023,1519,1520],{"class":1205},"??",[1023,1522,1523],{"class":1041}," ''",[1023,1525,1120],{"class":1028},[1023,1527,1497],{"class":1041},[1023,1529,1500],{"class":1028},[1023,1531,1532,1535,1538,1541,1544,1547,1550,1552,1555,1558,1560,1563,1565],{"class":1025,"line":68},[1023,1533,1534],{"class":1205},"  return",[1023,1536,1537],{"class":1028}," given.",[1023,1539,1540],{"class":1034},"length",[1023,1542,1543],{"class":1205}," ===",[1023,1545,1546],{"class":1034}," 32",[1023,1548,1549],{"class":1205}," &&",[1023,1551,1457],{"class":1028},[1023,1553,1554],{"class":1252},"timingSafeEqual",[1023,1556,1557],{"class":1028},"(given, Buffer.",[1023,1559,1212],{"class":1252},[1023,1561,1562],{"class":1028},"(expected, ",[1023,1564,1497],{"class":1041},[1023,1566,1567],{"class":1028},"));\n",[1023,1569,1570],{"class":1025,"line":73},[1023,1571,1137],{"class":1028},[1023,1573,1575],{"class":1025,"line":1574},15,[1023,1576,1238],{"emptyLinePlaceholder":1237},[1023,1578,1580,1583,1585,1587,1590,1593,1595,1598,1601,1604,1607,1609,1612,1614,1616],{"class":1025,"line":1579},16,[1023,1581,1582],{"class":1028},"app.",[1023,1584,98],{"class":1252},[1023,1586,1293],{"class":1028},[1023,1588,1589],{"class":1041},"'\u002Fwebhooks\u002Fcartirra'",[1023,1591,1592],{"class":1028},", express.",[1023,1594,1168],{"class":1252},[1023,1596,1597],{"class":1028},"({ type: ",[1023,1599,1600],{"class":1041},"'application\u002Fjson'",[1023,1602,1603],{"class":1028}," }), (",[1023,1605,1606],{"class":1296},"req",[1023,1608,1120],{"class":1028},[1023,1610,1611],{"class":1296},"res",[1023,1613,1355],{"class":1028},[1023,1615,1358],{"class":1205},[1023,1617,1618],{"class":1028}," {\n",[1023,1620,1622,1624,1626,1628,1631,1634,1637,1639,1642,1645,1647,1649,1652,1654,1656,1658,1661,1663,1666,1669,1671,1674],{"class":1025,"line":1621},17,[1023,1623,1392],{"class":1205},[1023,1625,1395],{"class":1028},[1023,1627,1398],{"class":1205},[1023,1629,1630],{"class":1252},"verify",[1023,1632,1633],{"class":1028},"(req.body.",[1023,1635,1636],{"class":1252},"toString",[1023,1638,1293],{"class":1028},[1023,1640,1641],{"class":1041},"'utf8'",[1023,1643,1644],{"class":1028},"), req.",[1023,1646,104],{"class":1252},[1023,1648,1293],{"class":1028},[1023,1650,1651],{"class":1041},"'Cartirra-Signature'",[1023,1653,1355],{"class":1028},[1023,1655,1520],{"class":1205},[1023,1657,1523],{"class":1041},[1023,1659,1660],{"class":1028},")) ",[1023,1662,1440],{"class":1205},[1023,1664,1665],{"class":1028}," res.",[1023,1667,1668],{"class":1252},"sendStatus",[1023,1670,1293],{"class":1028},[1023,1672,1673],{"class":1034},"400",[1023,1675,1500],{"class":1028},[1023,1677,1679,1681,1684,1686,1689,1691,1694,1696,1698,1700,1702],{"class":1025,"line":1678},18,[1023,1680,1320],{"class":1205},[1023,1682,1683],{"class":1034}," event",[1023,1685,1249],{"class":1205},[1023,1687,1688],{"class":1034}," JSON",[1023,1690,1158],{"class":1028},[1023,1692,1693],{"class":1252},"parse",[1023,1695,1633],{"class":1028},[1023,1697,1636],{"class":1252},[1023,1699,1293],{"class":1028},[1023,1701,1641],{"class":1041},[1023,1703,1567],{"class":1028},[1023,1705,1707,1710,1712,1714,1717,1720],{"class":1025,"line":1706},19,[1023,1708,1709],{"class":1028},"  res.",[1023,1711,1668],{"class":1252},[1023,1713,1293],{"class":1028},[1023,1715,1716],{"class":1034},"200",[1023,1718,1719],{"class":1028},"); ",[1023,1721,1722],{"class":1277},"\u002F\u002F answer first, then do the work\n",[1023,1724,1725,1728,1731,1734],{"class":1025,"line":78},[1023,1726,1727],{"class":1028},"  queue.",[1023,1729,1730],{"class":1252},"add",[1023,1732,1733],{"class":1028},"(event); ",[1023,1735,1736],{"class":1277},"\u002F\u002F e.g. fulfil the order in a background job\n",[1023,1738,1740],{"class":1025,"line":1739},21,[1023,1741,1742],{"class":1028},"});\n",[1014,1744,1748],{"className":1745,"code":1746,"language":1747,"meta":1019,"style":1019},"language-php shiki shiki-themes github-light github-dark","\u003C?php\n$secret = getenv('CARTIRRA_WEBHOOK_SECRET'); \u002F\u002F whsec_…\n$payload = file_get_contents('php:\u002F\u002Finput');\n$header = $_SERVER['HTTP_CARTIRRA_SIGNATURE'] ?? '';\n\nparse_str(str_replace(',', '&', $header), $parts);\n$timestamp = (int) ($parts['t'] ?? 0);\n$expected = hash_hmac('sha256', $timestamp . '.' . $payload, $secret);\n\nif (!$timestamp || abs(time() - $timestamp) > 300 || !hash_equals($expected, $parts['v1'] ?? '')) {\n    http_response_code(400);\n    exit;\n}\n\n$event = json_decode($payload, true);\nhttp_response_code(200);\n\u002F\u002F handle $event['type'] …\n","php",[633,1749,1750,1758,1778,1795,1817,1821,1843,1870,1898,1902,1959,1970,1977,1981,1985,2003,2014],{"__ignoreMap":1019},[1023,1751,1752,1755],{"class":1025,"line":12},[1023,1753,1754],{"class":1205},"\u003C?",[1023,1756,1757],{"class":1034},"php\n",[1023,1759,1760,1763,1766,1769,1771,1774,1776],{"class":1025,"line":17},[1023,1761,1762],{"class":1028},"$secret ",[1023,1764,1765],{"class":1205},"=",[1023,1767,1768],{"class":1034}," getenv",[1023,1770,1293],{"class":1028},[1023,1772,1773],{"class":1041},"'CARTIRRA_WEBHOOK_SECRET'",[1023,1775,1719],{"class":1028},[1023,1777,1278],{"class":1277},[1023,1779,1780,1783,1785,1788,1790,1793],{"class":1025,"line":42},[1023,1781,1782],{"class":1028},"$payload ",[1023,1784,1765],{"class":1205},[1023,1786,1787],{"class":1034}," file_get_contents",[1023,1789,1293],{"class":1028},[1023,1791,1792],{"class":1041},"'php:\u002F\u002Finput'",[1023,1794,1500],{"class":1028},[1023,1796,1797,1800,1802,1805,1808,1811,1813,1815],{"class":1025,"line":47},[1023,1798,1799],{"class":1028},"$header ",[1023,1801,1765],{"class":1205},[1023,1803,1804],{"class":1028}," $_SERVER[",[1023,1806,1807],{"class":1041},"'HTTP_CARTIRRA_SIGNATURE'",[1023,1809,1810],{"class":1028},"] ",[1023,1812,1520],{"class":1205},[1023,1814,1523],{"class":1041},[1023,1816,1218],{"class":1028},[1023,1818,1819],{"class":1025,"line":1072},[1023,1820,1238],{"emptyLinePlaceholder":1237},[1023,1822,1823,1826,1828,1831,1833,1835,1837,1840],{"class":1025,"line":1085},[1023,1824,1825],{"class":1034},"parse_str",[1023,1827,1293],{"class":1028},[1023,1829,1830],{"class":1034},"str_replace",[1023,1832,1293],{"class":1028},[1023,1834,1342],{"class":1041},[1023,1836,1120],{"class":1028},[1023,1838,1839],{"class":1041},"'&'",[1023,1841,1842],{"class":1028},", $header), $parts);\n",[1023,1844,1845,1848,1850,1852,1855,1858,1861,1863,1865,1868],{"class":1025,"line":1098},[1023,1846,1847],{"class":1028},"$timestamp ",[1023,1849,1765],{"class":1205},[1023,1851,1395],{"class":1028},[1023,1853,1854],{"class":1205},"int",[1023,1856,1857],{"class":1028},") ($parts[",[1023,1859,1860],{"class":1041},"'t'",[1023,1862,1810],{"class":1028},[1023,1864,1520],{"class":1205},[1023,1866,1867],{"class":1034}," 0",[1023,1869,1500],{"class":1028},[1023,1871,1872,1875,1877,1880,1882,1884,1887,1889,1892,1895],{"class":1025,"line":1134},[1023,1873,1874],{"class":1028},"$expected ",[1023,1876,1765],{"class":1205},[1023,1878,1879],{"class":1034}," hash_hmac",[1023,1881,1293],{"class":1028},[1023,1883,1465],{"class":1041},[1023,1885,1886],{"class":1028},", $timestamp ",[1023,1888,1158],{"class":1205},[1023,1890,1891],{"class":1041}," '.'",[1023,1893,1894],{"class":1205}," .",[1023,1896,1897],{"class":1028}," $payload, $secret);\n",[1023,1899,1900],{"class":1025,"line":1374},[1023,1901,1238],{"emptyLinePlaceholder":1237},[1023,1903,1904,1907,1909,1911,1913,1915,1918,1920,1923,1925,1928,1931,1933,1935,1938,1941,1944,1947,1950,1952,1954,1956],{"class":1025,"line":53},[1023,1905,1906],{"class":1205},"if",[1023,1908,1395],{"class":1028},[1023,1910,1398],{"class":1205},[1023,1912,1847],{"class":1028},[1023,1914,1404],{"class":1205},[1023,1916,1917],{"class":1034}," abs",[1023,1919,1293],{"class":1028},[1023,1921,1922],{"class":1034},"time",[1023,1924,1419],{"class":1028},[1023,1926,1927],{"class":1205},"-",[1023,1929,1930],{"class":1028}," $timestamp) ",[1023,1932,1434],{"class":1205},[1023,1934,1312],{"class":1034},[1023,1936,1937],{"class":1205}," ||",[1023,1939,1940],{"class":1205}," !",[1023,1942,1943],{"class":1034},"hash_equals",[1023,1945,1946],{"class":1028},"($expected, $parts[",[1023,1948,1949],{"class":1041},"'v1'",[1023,1951,1810],{"class":1028},[1023,1953,1520],{"class":1205},[1023,1955,1523],{"class":1041},[1023,1957,1958],{"class":1028},")) {\n",[1023,1960,1961,1964,1966,1968],{"class":1025,"line":58},[1023,1962,1963],{"class":1034},"    http_response_code",[1023,1965,1293],{"class":1028},[1023,1967,1673],{"class":1034},[1023,1969,1500],{"class":1028},[1023,1971,1972,1975],{"class":1025,"line":63},[1023,1973,1974],{"class":1205},"    exit",[1023,1976,1218],{"class":1028},[1023,1978,1979],{"class":1025,"line":68},[1023,1980,1137],{"class":1028},[1023,1982,1983],{"class":1025,"line":73},[1023,1984,1238],{"emptyLinePlaceholder":1237},[1023,1986,1987,1990,1992,1995,1998,2001],{"class":1025,"line":1574},[1023,1988,1989],{"class":1028},"$event ",[1023,1991,1765],{"class":1205},[1023,1993,1994],{"class":1034}," json_decode",[1023,1996,1997],{"class":1028},"($payload, ",[1023,1999,2000],{"class":1034},"true",[1023,2002,1500],{"class":1028},[1023,2004,2005,2008,2010,2012],{"class":1025,"line":1579},[1023,2006,2007],{"class":1034},"http_response_code",[1023,2009,1293],{"class":1028},[1023,2011,1716],{"class":1034},[1023,2013,1500],{"class":1028},[1023,2015,2016],{"class":1025,"line":1621},[1023,2017,2018],{"class":1277},"\u002F\u002F handle $event['type'] …\n",[638,2020,2022],{"id":2021},"answer-quickly","Answer quickly",[624,2024,2025,2026,2029,2030,2033],{},"Return any ",[633,2027,2028],{},"2xx"," within ",[628,2031,2032],{},"10 seconds",". Anything else, including a timeout or a redirect, counts as a failure. Do slow work (sending emails, calling other services) after responding, in a background job.",[638,2035,2037],{"id":2036},"retries","Retries",[624,2039,2040,2041,2044,2045,2048],{},"A failed delivery is retried up to 8 times with exponential backoff, starting at 10 seconds (10 s, 20 s, 40 s and so on), for about 21 minutes in all. After that the delivery is marked ",[628,2042,2043],{},"failed"," and your team gets a dashboard notification. You can resend any event from ",[628,2046,2047],{},"Developers → Webhooks → Events"," in the dashboard.",[638,2050,2052],{"id":2051},"duplicates-and-order","Duplicates and order",[2054,2055,2056,2069],"ul",{},[1163,2057,2058,2061,2062,2064,2065,2068],{},[628,2059,2060],{},"Expect duplicates."," A retry can arrive after your server already handled the event (for example if your ",[633,2063,2028],{}," was lost). Store each ",[633,2066,2067],{},"id"," you've processed and skip repeats.",[1163,2070,2071,2074,2075,2078],{},[628,2072,2073],{},"Don't rely on order."," Events can arrive out of order. When the order matters, read the current state from the API, for example ",[633,2076,2077],{},"GET \u002Fv1\u002Forders\u002F{id}",", instead of applying the event's snapshot blindly.",[638,2080,2082],{"id":2081},"catch-up-on-missed-events","Catch up on missed events",[624,2084,2085,2088,2089,2092],{},[633,2086,2087],{},"GET \u002Fv1\u002Fevents"," lists every event for your business and mode, newest first, and ",[633,2090,2091],{},"GET \u002Fv1\u002Fevents\u002F{id}"," shows an event with its delivery attempts. Use them to reconcile after an outage on your side.",[638,2094,2096],{"id":2095},"security-checklist","Security checklist",[2054,2098,2099,2106,2109,2115],{},[1163,2100,2101,2102,2105],{},"Use an ",[633,2103,2104],{},"https:\u002F\u002F"," URL. Live endpoints can't point at private or local addresses.",[1163,2107,2108],{},"Verify every signature, and reject old timestamps.",[1163,2110,2111,2112,2114],{},"Keep the ",[633,2113,1153],{}," secret on your server; rotate it from the dashboard if it leaks.",[1163,2116,2117],{},"Treat the payload as a hint, and read amounts and statuses from the API before you act on anything money-related.",[2119,2120,2121],"style",{},"html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}",{"title":1019,"searchDepth":17,"depth":42,"links":2123},[2124,2125,2126,2127,2128,2129,2130,2131],{"id":513,"depth":17,"text":512},{"id":943,"depth":17,"text":944},{"id":1146,"depth":17,"text":1147},{"id":2021,"depth":17,"text":2022},{"id":2036,"depth":17,"text":2037},{"id":2051,"depth":17,"text":2052},{"id":2081,"depth":17,"text":2082},{"id":2095,"depth":17,"text":2096},"md",{},{"title":77,"description":79},"guides\u002Fwebhooks","DEZEcJ4LlSWTaCBbtjt4w-FmT3cfVtLQFK6Zhv4DpY4",[2138,2140],{"title":72,"path":71,"stem":2139,"children":-1},"guides\u002Fversioning",{"title":82,"path":81,"stem":2141,"children":-1},"guides\u002Fchangelog",1795864569767]