"message": "Invalid object", "param": "address" stripe
const customer = {
'address[line1]': 'YOUR_ADDRESS_LINE1',
'address[line2]': 'YOUR_ADDRESS_LINE2',
'address[city]': 'YOUR_CITY',
'address[state]': 'YOUR_STATE',
'address[postal_code]': 'YOUR_PINCODE',
'address[country]': 'India',
'email': '[email protected]',
'phone': 'YOUR_NUMBER',
'name': 'Jenny Rosen'
}
return fetch('https://api.stripe.com/v1/customers', {
headers: {
Accept: 'application/json',
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: `Bearer ${"STRIPE_SECRET_KEY"}`
},
method: 'post',
body: Object.keys(customer)
.map(key => key + '=' + customer[key])
.join('&')
}).then(response => response.json());