Appearance

Visual style

Mode
Theme
Accent
Advanced
Text sizeScales the whole site
16 px
Reduce motionReduce animations or match your system
Separate light and darkChoose a theme, accent and font for each
50

Service · Business Automation & Integrations

Payment gateway integration for Stripe, Razorpay and Mercado Pago

I integrate payment gateways into websites, stores and platforms: Mercado Pago (PIX), Razorpay and Stripe. The work is mostly server-side: creating orders, verifying signed webhooks, updating order state idempotently, delivering what was bought, and reconciling events that go missing.

Payments dashboard with saved card, upcoming payments and recent transactions
Reference · Payments dashboard

Who it's for

Where payment integrations pays off

  • Taking payments for the first time

    Moving from bank transfers and manual confirmations to online payments that confirm themselves.

  • Payments that sometimes go missing

    Customers who paid but whose orders never updated, because the integration trusts the browser redirect or drops webhook retries.

  • Selling in a new region

    Adding PIX for Brazil, UPI and cards via Razorpay for India, or a provider suited to your market.

What's included

Capabilities and features

  • Server-side order creation

    Amounts are computed on the server and the provider order is created there, never from client-supplied prices.

  • Signed webhook verification

    HMAC signatures checked against the raw request body with constant-time comparison.

  • Queue-backed processing

    Webhooks are acknowledged quickly and processed by a consumer with retries and a dead-letter queue.

  • Idempotent fulfilment

    Duplicate events can't double-ship an order, issue two licences or send two download links.

  • Reconciliation

    A scheduled job that finds paid-but-unfulfilled orders and completes them.

  • Subscriptions

    Recurring billing with Stripe, with plan state kept in sync from webhooks.

The pattern I use for every provider

Checkout ──▶ API creates order (pending) + provider order
Buyer pays on provider UI
Provider ──webhook──▶ API: verify signature on raw body ──▶ enqueue event ──▶ 200 OK
Queue consumer: load order ──▶ already paid? stop : mark paid ──▶ fulfil ──▶ notify
Cron (every 6h): find paid & unfulfilled ──▶ fulfil

This is how the digital-products store I built works with Razorpay on Cloudflare Workers: payment events go through a Cloudflare Queue (with a dead-letter queue in production), fulfilment issues a download link that expires after 24 hours and allows five downloads, and a cron trigger every six hours completes any paid order that has no valid link.

Provider notes from real integrations

ProviderWhere I’ve used itNotes
Mercado PagoEkonavi marketplace commerce APIPIX and crypto payments; asynchronous, so orders must wait for verified notifications
RazorpayCreator digital-products storeHMAC-SHA256 webhook signatures over the raw body; payment.captured drives fulfilment
StripePersonal projects (custom product checkout, SaaS subscription)Checkout Sessions and subscription webhooks

What I look for when auditing an existing integration

  1. Does anything trust a price or a “success” flag from the browser?
  2. Are webhook signatures verified against the raw body?
  3. What happens if the same webhook arrives twice, or out of order?
  4. What happens if processing fails halfway?
  5. Is there a report of paid orders that were never fulfilled?

Approach

How a payment integrations project runs

  1. Choose the provider

    Based on your market, payment methods your customers use, fees and payout needs.

  2. Model order states

    Pending, paid, fulfilled, failed, refunded, and which events move between them.

  3. Integrate in sandbox

    Checkout, webhooks and failure cases tested with the provider's test mode, including duplicate and out-of-order events.

  4. Go live with monitoring

    Live keys, alerts on dead-lettered events and a reconciliation report for the first weeks.

FAQ

Payment Integrations: common questions

Which payment gateway should I use?

The one your customers already trust in your market. In Brazil that usually means supporting PIX, for example through Mercado Pago. In India, Razorpay covers UPI and cards. For international card payments and subscriptions, Stripe is the reference. Fees, payout schedules and supported business types also matter.

What is a payment webhook?

A message the payment provider sends to your server when something happens, such as a payment succeeding. Your server must verify that the message is genuine (using its signature), then update the order. The webhook is the reliable signal. The customer's browser returning to your site can't be trusted as proof of payment.

Why do payments sometimes succeed but orders don't update?

Usually because the integration relies on the browser redirect, rejects webhook retries, or fails partway through processing without retrying. Queue-backed, idempotent webhook processing plus a reconciliation job fixes all three.

Should my server ever store card details?

No. Use the payment provider's hosted checkout, payment page or secure fields, so card data goes straight to the provider and never touches your servers. That keeps you out of most PCI DSS scope; your server only handles order IDs, payment IDs and verified webhook events.

Need payments that confirm themselves?

Tell me what you sell, where your customers are and how payments work today. I'll suggest a provider and an integration plan.