我使用“paypal”付款方式:
$payer = new Payer();
$payer->setPaymentMethod('paypal');
我尝试过以下操作,但没有设置地址:
$addr = new Address();
$addr->setLine1('34/1');
$addr->setLine2('xxx');
$addr->setCity('xxxxxxx');
$addr->setCountry_code('US');
$addr->setPostal_code('43210');
$addr->setState('OH');
答案 0 :(得分:9)
ShippingAddress
扩展了Address个对象。因此,请设置所有Address
对象属性和ShippingAddress
特定属性(RecipientName
)。ShippingAddress
方法将创建的setShippingAddress
分配给ItemList:$shipping_address = new ShippingAddress();
$shipping_address->setCity('City');
$shipping_address->setCountryCode('AR');
$shipping_address->setPostalCode('200');
$shipping_address->setLine1('Adress Line1');
$shipping_address->setState('State');
$shipping_address->setRecipientName('Recipient Name');
$itemList->setShippingAddress($shipping_address);