Hello, after several attempts I am unable to automatically save the form in the database if the payment is validated.
I wanted at the time of the payment button, when the customer has finished his order and filled in the form, that the form is automatically saved in the database only if the payment is validated.
Here is my code below
import {createMyPayment} from ‘backend/pay’ ;
import wixPay from ‘wix-pay’ ;
export function button100_click(event) {
createMyPayment($w( ‘#TotalPrice’ ).text,$w( ‘#TotalPrice’ ).text)
.then( (payment) => {
wixPay.startPayment(payment.id, {
})
.then( (result) => {
if (result.status === “Successful” ) {
} **else if** (result.status === "Pending" ) {
$w( "#dataset1" ).save();
}
} );
} );
}