I\'m trying to implement the API
of PayPal payment
with Laravel 5.1
. But when I log in to PayPal (sandbox)
, it uses the addre
I have not used the PayPal API in a long while, but just skimming over the docs shows that the payer_info
shipping address field is deprecated (https://developer.paypal.com/docs/api/orders/v1/#definition-payer_info) and suggests to use the shipping address in the purchase_unit
instead.
According to the Docs, this should be set in the CartBase
class with the setItemList()
function (http://paypal.github.io/PayPal-PHP-SDK/docs/class-PayPal.Api.CartBase.html).
Edit:
So, for the package you are using, you'll need to add the PayPal\Api\ShippingAddress
object to your $item_list
variable:
$shipping = new PayPal\Api\ShippingAddress();
$shipping->setLine1('123 1st St.')
->setCity('Some City')
->setState('CA')
->setPostalCode("95123")
->setCountryCode("US")
->setPhone("555-555-5555")
->setRecipientName("John Doe");
$item_list = new ItemList();
$item_list->setItems([$item1])
->setShippingAddress($shipping);
ItemList
class ref: http://paypal.github.io/PayPal-PHP-SDK/docs/source-class-PayPal.Api.ItemList.html#74-85