PayPal iOS SDK响应送货地址:(null)

信息

  • 模式(模拟/沙盒/现场):沙盒
  • PayPal iOS SDK版本:2.14.3
  • iOS版本和设备(iOS 8.x,iPhone 6s上的iOS 9.3等):模拟器iPhone 5 iOS 9.3

描述

_payPalConfig = [[PayPalConfiguration alloc] init]; _payPalConfig.payPalShippingAddressOption = PayPalShippingAddressOptionPayPal; 

在PayPal控制器中,我select运送地址(PayPal账户地址)。 但作为回应,我收到货运地址:(空)。

 CurrencyCode: EUR Amount: 416.99 Short Description: Clothes Intent: sale Processable: Already processed Display: €416.99 Confirmation: { client = { environment = sandbox; "paypal_sdk_version" = "2.14.3"; platform = iOS; "product_name" = "PayPal iOS SDK"; }; response = { "create_time" = "2016-06-23T12:54:24Z"; id = "PAY-3H962440US5*******"; intent = sale; state = approved; }; "response_type" = payment; } Details: Subtotal: 299.99, Shipping: 117, Tax: (null) Shipping Address: (null) Invoice Number: (null) Custom: (null) Soft Descriptor: (null) BN code: (null) Item: '{Some|299.99|EUR|(null)}' 

为什么我得到回应发货地址:(空)?

你得到零,因为你应该在PayPalPayment.shippingAddress提供送货地址。 这是写在SDK的帮助

/// - PayPalShippingAddressOptionBoth: user will choose from the shipping address provided by your app, /// in the shippingAddress property of PayPalPayment, plus the shipping addresses on file for the user's PayPal account.

更新如果你想从PayPal得到地址尝试使用这些选项:

 PayPalConfiguration *configuration = [[PayPalConfiguration alloc] init]; configuration.merchantName = @"Name"; configuration.payPalShippingAddressOption = PayPalShippingAddressOptionPayPal; 

如果你想自己提供这样的东西:

 PayPalConfiguration *configuration = [[PayPalConfiguration alloc] init]; configuration.merchantName = @"Name"; configuration.payPalShippingAddressOption = PayPalShippingAddressOptionNone; PayPalPayment *payment = [[PayPalPayment alloc] init]; payment.amount = amount; payment.currencyCode = @"RUB"; payment.intent = PayPalPaymentIntentSale; PayPalShippingAddress *shippingAddress = [PayPalShippingAddress shippingAddressWithRecipientName:recipientName withLine1:address withLine2:nil withCity:city withState:nil withPostalCode:postalCode withCountryCode:countryCode]; payment.shippingAddress = shippingAddress;