Stripe (Open-Source Module)
Connect Stripe Checkout Sessions, signed webhooks, refunds, and automatic lost-webhook recovery via the standalone hydrohq/hydro-stripe repository.
Stripe support lives in the official open-source overlay repository [hydrohq/hydro-stripe](https://github.com/hydrohq/hydro-stripe) (MIT licensed, zero third-party SDK dependencies). Keeping Stripe out of core keeps the core binary lean while letting any ecommerce build plug Stripe in cleanly via -tags hydrostripe.
1. Install & Build
git clone https://github.com/hydrohq/hydrogo.git
git clone https://github.com/hydrohq/hydro-stripe.git
# Apply overlay and compile with Stripe support:
bash hydro-stripe/apply.sh ./hydrogo --build
# Or combine with commercial regional modules (PayTR, iyzico, Geliver, BizimHesap):
bash hydro-modules/apply.sh ./hydrogo
cd ./hydrogo && go build -tags hydromodules,hydrostripe -o bin/hydro ./cmd/hydro2. Configure Credentials (config.yaml or Environment)
modules:
commerce: true
stripe:
secret_key: "" # Prefer HYDRO_STRIPE_SECRET_KEY in environment / systemd EnvironmentFile
webhook_secret: "" # Prefer HYDRO_STRIPE_WEBHOOK_SECRET
success_url: "https://yourstore.com/checkout/success"
cancel_url: "https://yourstore.com/checkout/cancel"Supported environment variables: HYDRO_STRIPE_SECRET_KEY (sk_test_... / sk_live_...), HYDRO_STRIPE_WEBHOOK_SECRET (whsec_...), HYDRO_STRIPE_SUCCESS_URL, HYDRO_STRIPE_CANCEL_URL, and optional HYDRO_STRIPE_API_BASE_URL.
3. Webhook Endpoint & Events
Point your Stripe Dashboard webhook endpoint to POST https://yourstore.com/api/v1/payments/stripe/webhook and enable these events:
checkout.session.completed(settles immediate card/wallet payments)checkout.session.async_payment_succeeded(settles deferred methods such as SEPA/ACH)checkout.session.async_payment_failed&checkout.session.expired(logged cleanly while HydroGo releases stock holds)
Stripe-Signature) are verified with constant-time HMAC-SHA256 across rotated v1 keys inside a 300-second replay tolerance window, and /api/v1/payments/stripe/webhook stays reachable even during maintenance mode.4. Step-by-Step Testing & Verification
Verify that Stripe is active, reachable, and settling orders cleanly before opening traffic:
| Check | Command / Action | Expected Result |
|---|---|---|
| 1. Gateway Advertised | curl -s http://127.0.0.1:8080/api/v1/commerce/checkout-config | payment_methods includes "stripe" |
| 2. Local Webhook Relay | stripe listen --forward-to http://127.0.0.1:8080/api/v1/payments/stripe/webhook | Prints whsec_... and returns HTTP 200 on checkout events |
| 3. Full SQLite E2E Suite | go test -v -tags hydrostripe ./modules/payments/stripe/... | All unit tests + TestStripeFullStackSQLiteLifecycle (checkout, retry, webhook, refund, CheckPending) pass |
| 4. Production Guardrails | ./bin/hydro doctor --config config.yaml | Zero secret placeholder warnings or HTTPS config issues |
| 5. Reconciliation Sweep | ./bin/hydro commerce reconcile --hold 30m --json | Zero stale unpaid orders or reservation drift |
Lost-Webhook Recovery & Admin Refunds
GET /v1/checkout/sessions/{id}) and settles paid sessions idempotently. Issuing a refund via Admin Studio (/api/v1/admin/commerce/orders/{id}/refund) calls POST /v1/refunds and restores inventory if unshipped.