Open MercatoDocsSearch docsAPI reference

User guide

Stripe Payment Gateway

Enter the Stripe credentials for your test or live environment and check the connection. Keep the webhook configuration and payment sessions in that same environment.

Optional env preconfiguration

If your deployment already knows the Stripe credentials, you can preconfigure the Stripe integration automatically instead of filling the credentials form manually after every fresh install.

Use these env vars:

OM_INTEGRATION_STRIPE_PUBLISHABLE_KEY=pk_test_...
OM_INTEGRATION_STRIPE_SECRET_KEY=sk_test_...
OM_INTEGRATION_STRIPE_WEBHOOK_SECRET="<om-integration-stripe-webhook-secret>"
OM_INTEGRATION_STRIPE_API_VERSION=2025-02-24.acacia
OM_INTEGRATION_STRIPE_ENABLED=true
OM_INTEGRATION_STRIPE_FORCE_PRECONFIGURE=false

Notes:

To rerun the preset for an existing tenant:

yarn mercato gateway_stripe configure-from-env --tenant <tenantId> --org <organizationId>

Prerequisites

Step 1 – Enter Stripe credentials

  1. Navigate to External Systems → Integrations and click Configure on the Stripe card.
  2. Open the Credentials tab.
  3. Fill in three fields from your Stripe Dashboard → Developers → API keys:

FieldWhere to find itExample prefix
Publishable KeyAPI keys page – copy the publishable key for the mode (test or live) you want to usepk_test_... or pk_live_...
Secret KeyAPI keys page – reveal or rotate the secret key for the same modesk_test_... or sk_live_...
Webhook Signing SecretWebhooks page – the endpoint signing secret (see Step 4)whsec_...
  1. Click Save Credentials.

Caution

Use keys from the same mode – do not mix test publishable keys with live secret keys. Stripe will reject cross-mode requests.

Step 2 – Verify health

Switch to the Health tab and click Run Check.

Health check — Healthy

A Healthy result confirms Open Mercato can reach the Stripe API with your credentials. The details panel shows your Stripe account ID, country, business type, and whether charges and payouts are enabled.

If the check fails, double-check the secret key and ensure it matches the mode of the publishable key.

Step 3 – Test with the Payment Gateway Demo

Open Mercato ships with a built-in demo page for testing the full payment lifecycle without writing code. Navigate to the Payment Gateway Demo page (available in the example module).

Authorize a payment

Click Pay with Stripe. The demo creates a payment session through the hub, then uses Stripe.js to confirm the card payment with the test card 4242 4242 4242 4242.

Payment authorized

On success you will see:

Capture, refund, and cancel

From the Transaction Details card:

Refund successful

Each action calls the corresponding Payment Gateway API endpoint under the hood.

Verify on Stripe Dashboard

After running the demo, open Stripe Dashboard → Payments. You should see the matching transaction with the same amount and status:

Stripe transactions

The description field references the Open Mercato origin, making it easy to cross-reference.

Step 4 – Set up webhooks

Webhooks allow Stripe to push status updates (captures, refunds) and dispute notifications to Open Mercato in real time, instead of relying on polling. This is strongly recommended for production.

Configure the endpoint in Stripe

  1. Go to Stripe Dashboard → Developers → Webhooks.
  2. Click Add endpoint.
  3. Set the endpoint URL to:
https://YOUR_APP_URL/api/payment_gateways/webhook/stripe
  1. Subscribe to these events at minimum:
payment_intent.succeeded
payment_intent.payment_failed
payment_intent.canceled
payment_intent.requires_action
charge.refunded
charge.refund.updated
charge.dispute.created
charge.dispute.closed

A refund issued outside Open Mercato (for example from the Stripe dashboard) arrives as charge.refunded. When the charge shows refunded captured funds, a captured or partially captured gateway transaction moves to partially_refunded or refunded, depending on whether the charge is fully refunded, and a partially refunded one moves to refunded once everything captured is refunded. A refund that reaches Open Mercato before the payment's capture notification is still recorded. charge.refund.updated and the dispute events are received and recorded in the integration log; they do not change the transaction's unified status.

  1. After creating the endpoint, reveal the Signing secret (starts with whsec_).
  2. Paste it into the Webhook Signing Secret field in Open Mercato's Stripe credentials (see Step 1) and save.

Local development with ngrok

Stripe cannot reach localhost directly. Use a tunnel:

ngrok http 3000

Then set the webhook endpoint URL in Stripe to:

https://YOUR-NGROK-SUBDOMAIN.ngrok-free.app/api/payment_gateways/webhook/stripe

Remember to update the signing secret in Open Mercato whenever you recreate the Stripe webhook endpoint.

Step 5 – Monitor via integration logs

After running payments, check the Logs tab on the Stripe integration page to see a full audit trail:

Integration logs

Each log entry records the operation (session created, status updated, payment captured, payment refunded), the entity type and ID, and a structured payload you can copy for debugging.

Programmatic usage

For building custom checkout flows, headless storefronts, or server-to-server integrations, see the Payment Gateways REST API reference. It covers:

Next steps

Previous: Storage Hub — S3 Integration · Next: System status