Result status after Payment is not working

Hi!
I’m new on Wix and I’m trying to figure out why my code for showing lightboxes after payment is not working. The issue is inside the if statement where the condition involves result.status since actions work outside it. This is the code I usually see online for the approach and I’m wondering what am I doing wrong.

Note: Payment codes are already working. It’s really just the action after the payment.

Code:

Would it be possible that the status is neither success nor pending?

You can console.log() the result and see what is it.

Hi! In console.log(), the value is undefined and I’m not sure why. I tried adding all possible statuses and adding an else. The behavior is it’s always going to else, before the payment happens.

Now I have updated the code to the one below. But nothing happens. My expected behavior is a lightbox must show AFTER a successful/failed payment. Not sure if this matters but the payment option is via Xendit (since I’m reading issues on getting statuses on some payment options like PayMaya)

createMyPayment ( price , productItem )
. then (( payment ) => {
wixPay . startPayment ( payment . id ,{ “showThankYouPage” : false });
})
. then (( results ) => {
console . log ( results . status );
if ( results . status == “Successful” ) {
wixWindow . openLightbox ( “PaymentSuccess” );
}
else if ( results . status == “Pending” ) {
wixWindow . openLightbox ( “PaymentSuccess” );
}
else if ( results . status === “Failed” ) {
wixWindow . openLightbox ( “PaymentSuccess” );
}
else if ( results . status == “Chargeback” ) {
wixWindow . openLightbox ( “PaymentPending” );
}
else if ( results . status == “Refunded” ) {
wixWindow . openLightbox ( “PaymentSuccess” );
}
else if ( results . status == “Offline” ) {
wixWindow . openLightbox ( “PaymentSuccess” );
}
else if ( results . status == “PartiallyRefunded” ) {
wixWindow . openLightbox ( “PaymentSuccess” );
}
else if ( results . status == “Cancelled” ) {
wixWindow . openLightbox ( “PaymentSuccess” );
}
else if ( results . status == “Undefined” ) {
wixWindow . openLightbox ( “PaymentSuccess” );
}
});