I am using the Paypal Rest API. I have succesfully managed to submit the shipping address via the ItemList. However I can't manage to submit the billing address, so it will be prefilled for users without a Paypal Account. The billing address is always filled with the shipping address.
I have tried it according to the documentation here with the address object but I can't get it to work:
"Base Address object used as billing address in a payment or extended for Shipping Address." https://developer.paypal.com/docs/api/#address-object
$billing_address = new Address();
$billing_address->setLine1('Street Name');
$billing_address->setCity('city name');
$billing_address->setPostalCode('12345');
$billing_address->setCountryCode('DE');
Then I pass the $billing_address into the $payer_info along with the other payer information.
$payer_info->setBillingAddress($billing_address);
$payer->setPayer_info($payer_info) ;
However it seems that is not the correct way. How do I pass the billing address to Paypal.
PayPalpayment method? Are you able to see any error? Can you please share the above info? Please note that you cannot set billing address when using 'PayPal' as the payment method. - Mithun