Paypal Rest API - sending invoice address
I am using Paypal Rest API. I have successfully submitted my shipping address via ItemList. However, I am unable to submit a billing address, so it will be filled in for users without a Paypal account. The invoice address is always filled in with the delivery address.
I tried it according to the documentation here with the address, but I can't seem to get it to work:
"A base address object used as a billing address in a payment or for a 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 $ billing_address to $ payer_info along with other payer information.
$payer_info->setBillingAddress($billing_address); $payer->setPayer_info($payer_info) ;
However, this does not seem to be the case. How to transfer a billing address to Paypal.
source to share
If you are trying to send a credit card payment to the API, you must add a $ billing_address object to the $ card object:
<?php $billing_address = new Address();
$billing_address->setLine1('Street Name');
$billing_address->setCity('city name');
$billing_address->setState('city name');
$billing_address->setPostalCode('12345');
$billing_address->setCountryCode('US');
$card = new CreditCard();
$card->setType("visa")
->setNumber("4148529247832259")
->setExpireMonth("11")
->setExpireYear("2019")
->setCvv2("012")
->setFirstName("Joe")
->setLastName("Shopper")
->setBillingAddress($billing_address); ?>
I am not 100% if you added it for PayPal payment.
source to share