This commit is contained in:
2026-08-05 18:24:41 +08:00
parent 4086b64fc0
commit 79562ecb5c
6 changed files with 83 additions and 57 deletions
+36 -26
View File
@@ -265,10 +265,10 @@
extra: () => '&mc=0000&mode=02&purpose=00',
warn: 'QR-only merchant — link payment may be rejected. Scan QR instead.',
},
bharatpe_biz: { // can't work
bharatpe_biz: {
label: 'BharatPe Business',
pa: 'BHARATPE.8C0L1Q1Z4P67812@fbpe', pn: 'BharatPe Merchant',
extra: () => '&tn=Pay+To+BharatPe+Merchant',
pa: 'BHARATPE2M0J0C7U0S60086@unitype', pn: 'BharatPe Merchant',
extra: () => '&tn=efb7d9b8-1f17-48e6-bca7-c10f3e35620c',
warn: null,
},
paytm_per: {
@@ -305,27 +305,37 @@
};
function phonepeNative(pa, pn, am, note) {
const amount = Math.round(Number(am) * 100);
const payload = {
contact: { cbsName: '', nickName: pn, vpa: pa, type: 'VPA' },
contact: {
type: 'VPA',
vpa: pa,
cbsName: pn || '',
nickName: pn || '',
},
p2pPaymentCheckoutParams: {
note: note || 'payment',
isByDefaultKnownContact: true,
enableSpeechToText: false,
allowAmountEdit: false,
showQrCodeOption: false,
disableViewHistory: true,
shouldShowUnsavedContactBanner: false,
isRecurring: false,
checkoutType: 'DEFAULT',
transactionContext: 'p2p',
initialAmount: Math.round(parseFloat(am) * 100), // paise
disableNotesEdit: true,
showKeyboard: true,
currency: 'INR',
shouldShowMaskedNumber: true,
initialAmount: amount,
note: note || 'payment',
// Let PhonePe validate an external VPA instead of treating
// it as an already-known local contact.
isByDefaultKnownContact: false,
shouldShowUnsavedContactBanner: true,
disableViewHistory: true,
showKeyboard: false,
shouldShowMaskedNumber: false,
payContext: {
transferMode: 'PEER_TO_PEER',
message: note || 'payment',
tag: 'Miscellaneous',
},
},
};
return `phonepe://native?data=${encodeURIComponent(btoa(JSON.stringify(payload)))}&id=p2ppayment`;
const jsonBase64 = btoa(unescape(encodeURIComponent(JSON.stringify(payload))));
return `phonepe://native?data=${encodeURIComponent(jsonBase64)}&id=p2ppayment`;
}
function airtelBankTransferLink() {
@@ -381,14 +391,14 @@
}
const APP_SCHEMES = {
paytm: (pa, pn, am, extra) => `paytmmp://cash_wallet?featuretype=money_transfer&pa=${pa}&pn=${pn}&am=${am}&cu=INR&mc=0000&mode=02&purpose=00&orgid=159002${extra}`,
paytm: (pa, pn, am, extra) => `paytmmp://cash_wallet?featuretype=money_transfer&pa=${encodeURIComponent(pa)}&pn=${encodeURIComponent(pn)}&am=${encodeURIComponent(am)}&cu=INR&mc=0000&mode=02&purpose=00&orgid=159002${extra}`,
phonepe: (pa, pn, am) => phonepeNative(pa, pn, am, 'payment'),
phonepe_pay: (pa, pn, am, extra) => `phonepe://pay?pa=${pa}&pn=${pn}&am=${am}&cu=INR${extra}`,
gpay: (pa, pn, am, extra) => `gpay://upi/pay?pa=${pa}&pn=${pn}&am=${am}&cu=INR${extra}`,
phonepe_pay: (pa, pn, am, extra) => `phonepe://pay?pa=${encodeURIComponent(pa)}&pn=${encodeURIComponent(pn)}&am=${encodeURIComponent(am)}&cu=INR${extra}`,
gpay: (pa, pn, am, extra) => `gpay://upi/pay?pa=${encodeURIComponent(pa)}&pn=${encodeURIComponent(pn)}&am=${encodeURIComponent(am)}&cu=INR${extra}`,
mobikwik: (pa, pn, am, extra) => { const tn = (extra.match(/[?&]tn=([^&]*)/) || [])[1] || 'payment'; return `mobikwik://moneytransfer/upi/verifyVpa?vpa=${encodeURIComponent(pa)}&amount=${am}&note=${tn}`; },
freecharge: (pa, pn, am, extra) => `freechargeupi://pay?pa=${pa}&pn=${pn}&am=${am}&cu=INR${extra}`,
freecharge: (pa, pn, am, extra) => `freechargeupi://pay?pa=${encodeURIComponent(pa)}&pn=${encodeURIComponent(pn)}&am=${encodeURIComponent(am)}&cu=INR${extra}`,
// fallback handled in scheduleAutoClick
upi: (pa, pn, am, extra) => `upi://pay?pa=${pa}&pn=${pn}&am=${am}&cu=INR${extra}`,
upi: (pa, pn, am, extra) => `upi://pay?pa=${encodeURIComponent(pa)}&pn=${encodeURIComponent(pn)}&am=${encodeURIComponent(am)}&cu=INR${extra}`,
};
const APP_COLORS = {
@@ -439,7 +449,7 @@
}
const link = w.pa
? APP_SCHEMES[app](w.pa, encodeURIComponent(w.pn), am, w.extra())
? APP_SCHEMES[app](w.pa, w.pn, am, w.extra())
: '';
document.getElementById('info-pn').textContent = w.pn || '—';
@@ -491,4 +501,4 @@
</script>
</body>
</html>
</html>