I added PayPal button to React and I want to be able to get the billing address from PayPal
React.useEffect(() => {
window.paypal
.Buttons({
createOrder: (data, actions, err) => {
return actions.order.create({
intent: 'CAPTURE',
purchase_units: [
{
amount: {
currency_code: 'GBP',
value: Math.ceil(total * 0.72411175 * 100) / 100,
},
},
],
})
},
onApprove: async (data, actions) => {
const order = await actions.order.capture()
//console.log(order)
},
onError: (err) => {
console.log(err)
},
})
.render(paypal.current)
}, []) // eslint-disable-line
but this only returns an object with the ID, Name and Email, and I want to be able to get the address, phone number and postal code. How should I do that?