Overview
PayU
Accept payments with PayU
@sam-ael/medusa-plugin-payu
Production-focused PayU India payment provider for Medusa v2 with redirect checkout flow, callback handling, and fraud-aware verification.
Highlights
- Redirect-based PayU checkout integration for Medusa payment sessions
- Hash generation and reverse-hash verification flow
- Webhook/callback handling for asynchronous payment status
- Hardened callback processing with replay protection
- Constant-time hash comparison and amount discrepancy guards
- Timeout configuration and retry-classification utilities
Install
1yarn add @sam-ael/medusa-plugin-payu
Medusa Configuration
123456789101112131415161718modules: [{resolve: "@medusajs/medusa/payment",options: {providers: [{resolve: "@sam-ael/medusa-plugin-payu/providers/payu",id: "payu",options: {merchantKey: process.env.PAYU_MERCHANT_KEY,merchantSalt: process.env.PAYU_MERCHANT_SALT,environment: process.env.PAYU_ENVIRONMENT || "test",},},],},},]
Environment Variables
12345678PAYU_MERCHANT_KEY=your_merchant_keyPAYU_MERCHANT_SALT=your_merchant_saltPAYU_ENVIRONMENT=testSTOREFRONT_URL=http://localhost:8000PAYU_REDIRECT_URL=/order/confirmedPAYU_REDIRECT_FAILURE_URL=/checkoutPAYU_API_TIMEOUT_MS=30000
Callback Endpoint
Method Endpoint Description Copy to clipboardPOST Copy to clipboard/hooks/payment/payu_payu PayU callback/webhook handling via Medusa payment provider
Security and Reliability Notes
- Replay guard for repeated callback payloads
- Constant-time hash comparison for webhook verification
- Normalized callback parsing for structured and URL-encoded payload variants
- Amount discrepancy path for underpaid callback reports
- Timeout defaults centralized in provider config helpers
Quality Gates
1234yarn typecheckyarn lintyarn testyarn build
Smoke tests are available under Copy to clipboardsrc/tests.
License
MIT
