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
+12 -3
View File
@@ -164,6 +164,9 @@ Alpine.data('miniPaymentLanding', (config = {}) => ({
errorMsg: config.errorMsg ?? '',
showSheet: false,
checkoutUrl: '',
accessCode: '',
publicKey: '',
returnUrl: '',
paymentSheetStyle: '',
sheetBleedStyle: '',
@@ -218,7 +221,10 @@ Alpine.data('miniPaymentLanding', (config = {}) => ({
this.errorMsg = '';
this.loading = true;
this.checkoutUrl = '';
// Show sheet/modal immediately; Paystack opens from the in-sheet Continue CTA.
this.accessCode = '';
this.publicKey = '';
this.returnUrl = '';
// Show sheet/modal immediately; Paystack Inline opens in-page from the sheet.
this.showSheet = true;
const controller = new AbortController();
@@ -245,7 +251,7 @@ Alpine.data('miniPaymentLanding', (config = {}) => ({
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;
@@ -255,7 +261,10 @@ Alpine.data('miniPaymentLanding', (config = {}) => ({
// (cross-origin iframe is blank / looks like "Pay did nothing").
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);