checkoutOs
Rails & gateways

Paytm

Checksum-signed form posts, a form-encoded webhook body, and the quirks that will bite you in production.

Paytm is fully implemented (src/gateways/paytm/paytm.plugin.ts) and registered through createPaytmPlugin().

Configuration

ACTIVE_GATEWAY=paytm
PAYTM_MERCHANT_ID=your_merchant_id
PAYTM_MERCHANT_KEY=your_merchant_key
PAYTM_WEBHOOK_SECRET=your_webhook_secret
PAYTM_WEBSITE_NAME=DEFAULT

Default base URL is https://securegw.paytm.in.

websiteName defaults to WEBSTAGING

The plugin uses 'WEBSTAGING' when PAYTM_WEBSITE_NAME is unset. That is a staging value — shipping it to production means every transaction is rejected. Set it explicitly.

Checkout

Paytm hosts its own payment page. getCheckoutAction() returns a redirect action, and GET /checkout/:chkId issues a 302 to the gateway URL created during payment creation.

Requirements beyond the common contract

customerPhone is required. Omitting it raises PAYTM_PHONE_REQUIRED (400) rather than failing upstream with an opaque Paytm error.

Webhooks

Paytm posts a form-encoded body, not JSON.

A second load-sensitive middleware

src/app.ts mounts express.urlencoded() for /webhooks/paytm before the webhook router and before the global express.json(). The overall order is:

  1. express.raw() for /webhooks/razorpay
  2. express.urlencoded() for /webhooks/paytm
  3. the webhook router
  4. express.json() for everything else

Verification uses Paytm's CHECKSUMHASH scheme. A request whose checksum does not verify is rejected before any state changes; it is never treated as a valid event.

No refund status polling

getRefundStatus() always throws

GatewayUnavailableError, unconditionally — Paytm does not support polling refund status. A refund's terminal state arrives by webhook or not at all, so do not build a reconciliation job around polling here.

On this page