Use Cases
- Order Fulfillment: Trigger downstream processes when a checkout intent completes.
- Error Handling: React immediately when an offer retrieval or order placement fails.
- Customer Notifications: Send real-time updates to buyers about their order status.
Setting Up Webhooks
Navigate to Account Settings
Go to the Rye Console and find the Webhooks section on the accounts tab.
Set Up an Endpoint
Enter your publicly accessible endpoint URL. It must be reachable over the internet and capable of handling HTTP POST requests.
URL Verification Handshake
After saving your endpoint, Rye sends a verification request containing a Expected Response:
challenge parameter. Your endpoint must respond with the exact challenge value.Verification Request:Implement Signature Verification
Each webhook includes a cryptographic signature to verify its authenticity. See the verification section below.
Events
Webhooks are sent when a checkout intent transitions between states. See the Checkout Intent Lifecycle for the full state machine.| Event | Description | State Transition |
|---|---|---|
checkout_intent.offer_retrieved | An offer is ready with pricing and availability details. | retrieving_offer → awaiting_confirmation |
checkout_intent.offer_failed | Offer retrieval failed (e.g., unsupported merchant, product unavailable). | retrieving_offer → failed |
checkout_intent.completed | The order was successfully placed and confirmed. | placing_order → completed |
checkout_intent.order_failed | Order placement failed after confirmation (e.g., out of stock, payment declined). | placing_order → failed |
Payload Format
Webhook payloads are thin events — they contain the checkout intent ID and the event type, not the full resource. To get the complete checkout intent state, call the API after receiving the event. Example Payload:Thin events keep webhook payloads small and stable. The API always returns the most current state of the checkout intent, so fetching after notification ensures you have the latest data.
Webhook Headers
Every webhook request includes the following headers:| Header | Description |
|---|---|
x-rye-signature | HMAC-SHA256 signature for verifying authenticity. |
x-rye-event-id | Unique event ID. |
x-rye-timestamp | Unix timestamp (seconds) of the event delivery. |
x-rye-topic | The event topic (e.g., checkout_intent.completed). |
Verifying Webhook Signatures
Each webhook is signed using HMAC-SHA256 with your HMAC secret key, available in the Rye Console under the Webhooks section.Signature Format
Thex-rye-signature header contains a hex-encoded HMAC-SHA256 signature of the raw request body:
Verification Steps
- Extract the signature value from the
x-rye-signatureheader (strip thev0=prefix). - Compute HMAC-SHA256 of the raw request body using your secret key.
- Hex-encode the result and compare with the extracted signature using a constant-time comparison.
- Reject the request if they do not match.
Code Examples
Best Practices
Process Webhooks Asynchronously
Webhook requests must respond within 5 seconds. Verify the signature, acknowledge receipt, and process the event in the background.Handle Out-of-Order Delivery
Webhooks may arrive out of order. Use thecreatedAt field to determine event ordering, or simply fetch the latest state from the API — since events are thin notifications, the API always returns the most current data.
Deduplicate Events
Each event has a deterministicid (e.g., evt_ci_abc123def456_completed). Store processed event IDs to skip duplicates:
- Extract the event
idfrom the payload. - Check if you’ve already processed this
id. - If yes, return
200without reprocessing. - If no, process the event and store the
id.

