Restore Paystack Inline in-page sheet/modal; stop separate-browser checkout.
Deploy Ladill Mini / deploy (push) Successful in 1m4s

Pass access_code through pay responses and launch PaystackPop from the shared sheet instead of window.open.
This commit is contained in:
isaacclad
2026-07-21 19:12:24 +00:00
parent 42257ab444
commit 86d2dcbf0b
9 changed files with 280 additions and 96 deletions
@@ -139,6 +139,9 @@
errorMsg: config.errorMsg ?? '',
showSheet: false,
checkoutUrl: '',
accessCode: '',
publicKey: '',
returnUrl: '',
paymentSheetStyle: '',
sheetBleedStyle: '',
init() {
@@ -169,8 +172,10 @@
this.errorMsg = '';
this.loading = true;
this.checkoutUrl = '';
// Open sheet chrome immediately so mobile bottom sheet / desktop
// modal is visible before Paystack (popup opens from Continue).
this.accessCode = '';
this.publicKey = '';
this.returnUrl = '';
// Open sheet chrome immediately (mobile bottom sheet / desktop modal).
this.showSheet = true;
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), 45000);
@@ -195,7 +200,7 @@
this.errorMsg = apiError || ('Could not start payment (' + res.status + '). Please try again.');
return;
}
if (!data.checkout_url) {
if (!data.checkout_url && !data.access_code) {
this.showSheet = false;
this.errorMsg = 'Could not start payment. Please try again.';
return;
@@ -203,7 +208,10 @@
// Legacy MoMo waiting page must be full-page — never trap it in the Paystack iframe.
const useSheet = data.provider !== 'mtn_momo';
if (useSheet) {
this.checkoutUrl = data.checkout_url;
this.checkoutUrl = data.checkout_url || '';
this.accessCode = data.access_code || '';
this.publicKey = data.public_key || '';
this.returnUrl = data.callback_url || '';
} else {
this.showSheet = false;
window.location.assign(data.checkout_url);