如何从Adaptive Payment API调用中获取送货地址?

时间:2014-04-07 13:18:10

标签: paypal paypal-ipn paypal-adaptive-payments

您应该如何使用 PayPal的自适应API 系统从并行付款中获取送货信息?通常,当请求IPN脚本时,它会以 payer_country 等方式传回。但是,情况似乎并非如此。

以下是调用IPN脚本时传入的参数:

transaction[0].amount 
transaction[0].id 
verify_sign 
transaction[1].receiver 
reverse_all_parallel_payments_on_error 
transaction[1].pending_reason 
transaction[0].pending_reason 
transaction[1].id_for_sender_txn 
transaction[0].invoiceId 
payment_request_date 
test_ipn 
cancel_url 
charset 
return_url 
transaction[0].status_for_sender_txn 
ipn_notification_url 
transaction[1].is_primary_receiver 
transaction[1].status 
transaction_type 
transaction[1].amount 
transaction[0].status 
log_default_shipping_address_in_transaction 
transaction[0].receiver 
status 
transaction[0].id_for_sender_txn 
action_type 
fees_payer 
pay_key 
transaction[1].status_for_sender_txn 
transaction[0].paymentType 
transaction[1].invoiceId 
transaction[1].id 
sender_email 
notify_version 
transaction[1].paymentType 
transaction[0].is_primary_receiver 

如果我然后进行PaymentDetails API调用,我会收到类似的内容:

$VAR1 = {
  'currencyCode' => 'USD',
  'responseEnvelope' => {
                          'correlationId' => '9944330ab9a8c',
                          'timestamp' => '2014-04-07T06:08:16.094-07:00',
                          'ack' => 'Success',
                          'build' => '10273932'
                        },
  'status' => 'COMPLETED',
  'senderEmail' => 'andy.aaaa@ultranerds.co.uk',
  'cancelUrl' => 'http://somesite.net/paypal/cancel.html',
  'paymentInfoList' => {
                         'paymentInfo' => [
                                            {
                                              'pendingRefund' => 'false',
                                              'receiver' => {
                                                              'accountId' => 'NY3AD33DD739C',
                                                              'email' => 'andy-xxx@ultranerds.com',
                                                              'amount' => '65.00',
                                                              'invoiceId' => '1022',
                                                              'primary' => 'false',
                                                              'paymentType' => 'GOODS'
                                                            },
                                              'transactionId' => '8E1114341X895213Y',
                                              'senderTransactionStatus' => 'COMPLETED',
                                              'senderTransactionId' => '5EV71352C33256006',
                                              'transactionStatus' => 'COMPLETED',
                                              'refundedAmount' => '0.00'
                                            },
                                            {
                                              'pendingRefund' => 'false',
                                              'receiver' => {
                                                              'accountId' => 'YYP5C69YWCMKE',
                                                              'email' => 'andy.yyy@gmail.com',
                                                              'amount' => '15.00',
                                                              'invoiceId' => '1023',
                                                              'primary' => 'false',
                                                              'paymentType' => 'GOODS'
                                                            },
                                              'transactionId' => '68H86656UP574062X',
                                              'senderTransactionStatus' => 'COMPLETED',
                                              'senderTransactionId' => '2XW88939LK1112523',
                                              'transactionStatus' => 'COMPLETED',
                                              'refundedAmount' => '0.00'
                                            }
                                          ]
                       },
  'feesPayer' => 'EACHRECEIVER',
  'actionType' => 'CREATE',
  'ipnNotificationUrl' => 'http://somesite.net/paypal/test_ipn.cgi',
  'sender' => {
                'useCredentials' => 'false',
                'accountId' => 'B74RBM5F6SLZG',
                'email' => 'andy.aaa@ultranerds.co.uk'
              },
  'returnUrl' => 'http://somesite.net/paypal/success.html',
  'payKey' => 'AP-4EK17906VB6613533',
  'reverseAllParallelPaymentsOnError' => 'false'
};

如您所见,根本没有提及送货地址。你怎么能得到这些信息?

更新嗯,好吧,看起来像 GetShippingAddresses 就是我需要的东西 - 但出于某些原因,当我打电话时它什么都没有回来:

{"requestEnvelope":{"errorLanguage":"en_US","detailLevel":"ReturnAll"},"key":"AP-1B1377463N9785350"} /GetShippingAddresses_API_Operation/

......简单地回复:

{
    'responseEnvelope' => {
                      'correlationId' => '3a4443aed09c9',
                      'timestamp' => '2014-04-07T06:40:35.460-07:00',
                      'ack' => 'Success',
                      'build' => '10273932'
                    }
}

我有点困惑为什么要这样做。有什么建议?

我在这里找到了一个引用:

http://go.developer.ebay.com/devzone/articles/using-paypals-adaptive-payments-and-google-app-engine-build-online-market-python-part-3

  

不幸的是,虽然这遵循了推荐的过程   PayPal的文档,它不起作用。目前有一个错误   PayPal的自适应支付实施。对于传统付款,   未收取送货地址;对于嵌入式支付,   GetShippingAddresses电话不会返回送货地址。

     

PayPal承认了这个错误并表示它预计会有   这已于2011年4月修复。如果您现在需要送货地址,   建议是在您的网站上收集它们而不是依赖它们   在PayPal API上。

那是从2011年开始......但情况仍然如此?

抱歉碰撞 - 但有人有任何建议吗?

1 个答案:

答案 0 :(得分:2)

好的,我得到了答案 - 但不幸的是,这不是我所希望的:

  

是的,很遗憾,此功能仅适用于嵌入式付款   流。   https://developer.paypal.com/webapps/developer/docs/classic/adaptive-payments/ht_ap-embeddedPayment-curl-etc/

     

如果您正在使用嵌入式付款流程,那么您可以检索   通过传入他们的PayPal帐户地址   senderOptions.requireShippingAddressSelection = true期间   SetPaymentOption API调用。然后,您可以通过它检索它   GetShippingAddresses API调用。

所以看起来我真的需要做的是,要求用户在发送给PayPal之前提供他们的送货信息,然后存储它。不理想 - 但我猜你只需要处理你得到的东西!