I am going a bit crazy. Our registration page used to work all the time—accepting payments and saving the registration info. Now, sometimes the info is not saved. Why? We successfully get the money but it needs to be matched to registration info obviously.
let course ;
let quantity ;
if ( $w ( “#radioGroup1” ). value === “course” ) { //regular course payment
course = $w ( “#text148” ). text ;
quantity = 1
let pricetext = $w ( “#text120” ). text ;
let price = parseInt ( pricetext );
console . log ( price );
createMyPayment ( course , price , quantity )
. then ( ( payment ) => {
wixPay . startPayment ( payment . id )
. then ( ( result ) => {
if ( result . status === “Successful” ) {
$w ( “#dataset3” ). setFieldValue ( “paymentStatus” , “Paid” );
$w ( “#dataset3” ). save ();
$w ( "#text147" ). text = "Thank-you! You are now registered for " + $w ( "#text146" ). text ;
$w ( "#text147" ). show () // handle payment success
} **else if** ( result . status === "Failed" ) {
// handle payment failure
} **else if** ( result . status === "Pending" ) {
// handle payment pending
} **else if** ( result . status === "Cancelled" ) {
// handle user closing payment panel
}
} );
} );
}