Hello
I can’t pass a decimal value as price for custom payment creation using wix-pay
Here’s my code
backend
export function createMyPayment ( priceamount , userInfo ) {
let pricer = Number ( priceamount )
return wixPayBackend . createPayment ({
items : [{
name : “Product” ,
price : pricer ,
quantity : 1
}],
amount : pricer ,
userInfo : userInfo
});
}
frontend
let price = 2.99 ;
let userInfo = {
“firstName” : “firstName” ,
“lastName” : “lastName” ,
“phone” : “12345678” ,
“email” : “email@gm.co”
}
createMyPayment1 ( price , userInfo )
. then (( payment ) => {
wixPay . startPayment ( payment . id )
. then (( result ) => {
**if** ( result . status === "Successful" ) {
// 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
}
});
});
If I change 2.99 to 2, any whole number, it would work
but not like this
Get this error
I have tried rounding off the number and everything still does not work
Any help appreciated
Thanks