A self-hosted UPI & COD payment gateway with zero per-transaction platform fees, universal JavaScript checkout integration, dynamic QR payments, WhatsApp OTP authentication, and automated payment verification.
JavaScript
fix(sdk): preserve reopened checkout in universal bundle
generaltony0072aaa84cbf8c6
diff --git a/packages/merchant-sdk/src/youpi.js b/packages/merchant-sdk/src/youpi.jsindex d557aae..4011a2c 100644--- a/packages/merchant-sdk/src/youpi.js+++ b/packages/merchant-sdk/src/youpi.js@@ -334,13 +334,17 @@this.backdrop.classList.remove('active');}+ // The closing modal may no longer be the current one when its animation ends.+ const closingBackdrop = this.backdrop;setTimeout(() => {- if (this.backdrop && this.backdrop.parentNode) {- this.backdrop.parentNode.removeChild(this.backdrop);+ if (closingBackdrop && closingBackdrop.parentNode) {+ closingBackdrop.parentNode.removeChild(closingBackdrop);+ }+ if (this.backdrop === closingBackdrop) {+ this.backdrop = null;+ this.container = null;+ this.iframe = null;}- this.backdrop = null;- this.container = null;- this.iframe = null;if (typeof this.options.onClose === 'function') {this.options.onClose();@@ -451,6 +455,7 @@ _isSafeRedirect(url) {const rawData = e.data.data || e.data;if (event === 'youpi.payment_success') {+ const successBackdrop = this.backdrop;const payload = e.data.data || {};const result = {status: 'SUCCESS',@@ -474,6 +479,7 @@ _isSafeRedirect(url) {}setTimeout(() => {+ if (!this.isOpen || this.backdrop !== successBackdrop) return;this.close(() => {if (this.options.successUrl) {const delim = this.options.successUrl.includes('?') ? '&' : '?';