Your code is missing the coins property on the contactInfo object.
It should be like this:
import wixUsers from 'wix-users'
$w.onReady(function () {
$w('#button1').onClick(function () {
let email = $w('#input1').value
let password = $w('#input2').value
let coins = Number($w('#input3').value)
wixUsers.register(email, password, {
contactInfo: {
coins,
},
},
})
})
})
But I recommend that you migrate to the new Members API because the Users API is deprecated.
It will be something like this:
import { authentication } from 'wix-members'
$w.onReady(() => {
$w('#button1').onClick(async () => {
let email = $w('#input1').value
let password = $w('#input2').value
let coins = Number($w('#input3').value)
//Create Options Object with contact info and custom fields
let options = {
contactInfo: {
coins,
},
}
try {
const registrationResult = await authentication.register(
email,
password,
options
)
console.log(registrationResult)
} catch (error) {
console.error(error)
}
})
})
