PayPal iOS SDK 响应发货地址:(空)

Posted

技术标签:

【中文标题】PayPal iOS SDK 响应发货地址:(空)【英文标题】:PayPal iOS SDK response Shipping Address: (null) 【发布时间】:2016-10-25 21:37:32 【问题描述】:

信息

模式(模拟/沙盒/直播):沙盒 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 控制器中,我选择送货地址(PayPal 帐户地址)。但作为回应,我得到了送货地址:(null)。

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)'

为什么我会收到回复 Shipping Address: (null)?

【问题讨论】:

【参考方案1】:

您得到零,因为您应该在 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;

【讨论】:

是的,我知道。但如果我设置 _payPalConfig.payPalShippingAddressOption = PayPalShippingAddressOptionPayPal;并选择送货地址,然后我也得到“送货地址:(空)”。我需要从 payPal 帐户中选择地址,而不是从应用程序地址中选择地址 我需要从 payPal 选择的帐户地址获取回复送货地址 如果您想从贝宝中选择地址,请尝试设置 PayPalShippingAddressOptionPayPal。 是的,我试试。但我也收到“送货地址:(空)”。 看_payPalConfig = [[PayPalConfiguration alloc] init]; _payPalConfig.payPalShippingAddressOption = PayPalShippingAddressOptionPayPal;我收到回复“送货地址:(空)”

以上是关于PayPal iOS SDK 响应发货地址:(空)的主要内容,如果未能解决你的问题,请参考以下文章

PayPal iOS SDK 示例应用

使用 PayPal PHP SDK 在 PayPal Sandbox 上执行支付时,得到 Http 响应代码 400

PayPal SDK 沙​​盒模式返回带有错误链接的响应

Curl / php 来自 PayPal IPN url 的空响应

在 swift 项目中导入 PayPal-iOS-SDK

Paypal IPN 协议:为啥示例中没有发送空的 HTTP 200 响应?