I'm allowing credit card payment with paypal smart buttons. This is how my createOrder looks like:
createOrder: function(data, actions) {
paypalActions = actions;
return fetch('/basket/get/lineitems', {
method: 'get'
}).then(function(res) {
return res.json();
}).then(function(orderData) {
orderDataArray = [orderData]
return actions.order.create({
payer: {
name: {
given_name: "PayPal",
surname: "Customer"
},
address: {
address_line_1: '123 ABC Street',
address_line_2: 'Apt 2',
admin_area_2: 'San Jose',
admin_area_1: 'CA',
postal_code: '95121',
country_code: 'US'
},
email_address: "customer@domain.com",
phone: {
phone_type: "MOBILE",
phone_number: {
national_number: "12345678"
}
}
},
purchase_units: orderDataArray,
shipping_type: 'PICKUP',
application_context: { shipping_preference: 'NO_SHIPPING' }
})
});
},
(The fetch requests gets my card items.)
Following the docs: https://developer.paypal.com/docs/checkout/integration-features/standard-card-fields/#optimize-the-card-fields it's working nicely to pass the billing address which I already have. Only the phone Number does not get filled.
What is needed to fill the phone field with above example? Or even better is it possible to set it to not required?
