12#include "StripeKit/Async.h"
13#include "StripeKit/Events.h"
14#include "StripeKit/Logging.h"
15#include "StripeKit/WebhookDedupStore.h"
16#include "StripeKit/WebhookVerifier.h"
36 std::chrono::system_clock::time_point
now = std::chrono::system_clock::now();
45 std::chrono::seconds
tolerance = std::chrono::minutes(5);
64 std::chrono::system_clock::time_point
now = std::chrono::system_clock::now();
67 std::chrono::seconds
tolerance = std::chrono::minutes(5);
127 std::string_view signature_header,
128 std::string_view endpoint_secret,
179 std::string_view signature_header,
180 std::string_view endpoint_secret,
Receives StripeKit's log entries.
The result of an asynchronous StripeKit operation.
Remembers which webhook events have been handled.
Task< ProcessEventOnceResult > process_event_once(const Event &event, WebhookDedupStore &dedup_store, EventHandler handler, ProcessEventOptions options={})
Runs the handler for an already-verified event unless it was already completed.
WebhookResponseAction
What to tell Stripe about a delivery.
ClaimOutcome
The result of trying to reserve an event for processing.
Event construct_event(std::string_view payload, std::string_view signature_header, std::string_view endpoint_secret, ConstructEventOptions options={})
Checks that a webhook delivery really came from Stripe, and parses it.
EventDispatchResult ProcessResult
What a handler reports back about an event.
EventDispatchResult
What a webhook handler reports back about an event.
constexpr std::chrono::minutes defaultStaleInflightTimeout
How long an unfinished claim is honoured before another process may take it.
std::function< Task< ProcessResult >(const Event &)> EventHandler
The application's webhook handler.
EventEnvelope Event
A verified Stripe webhook event.
@ FatalStoreError
The store failed in a non-recoverable way.
A Stripe event, as delivered by a webhook.
Tuning for construct_event().
std::chrono::seconds tolerance
How far the signature's timestamp may be from now.
std::chrono::system_clock::time_point now
Current time, used to check the signature's timestamp.
What happened to a webhook delivery.
ClaimOutcome claim_outcome
Whether this delivery was the one that got to run the handler.
std::string event_id
Id of the event, when it could be parsed.
std::string event_type
Type of the event, when it could be parsed.
WebhookResponseAction response_action
Whether to answer Stripe with success, or ask it to retry.
Tuning for process_event_once().
std::chrono::seconds tolerance
How far the signature's timestamp may be from now.
std::chrono::minutes stale_inflight_timeout
How long before a claim left behind by a crashed process is reclaimed.
Logger * logger
Where to report store and handler failures.
std::chrono::system_clock::time_point now
Current time, used for signature checks and claim timing.