【问题标题】:How do I access the Express Checkout Details from the response?如何从响应中访问 Express Checkout 详细信息?
【发布时间】:2014-05-27 03:35:01
【问题描述】:

我在implementation guide 的第 4 步,到目前为止一切都很顺利。然而,我现在的问题是在他们成功通过 Paypal 进行身份验证后检索用户详细信息。

使用paypal-sdk-merchant gem,这是当用户在验证后从 Paypal 返回时触发的方法:

def confirm
    @api = PayPal::SDK::Merchant::API.new
    @get_express_checkout_details = @api.build_get_express_checkout_details({:Token => params[:token]})
    @get_express_checkout_details_response = @api.get_express_checkout_details(@get_express_checkout_details)
end

指南(链接到上面)指出:

A response will be returned containing the user's shipping address, the transaction status, and more:

TOKEN=EC-1234567890&ACK=Success&CHECKOUTSTATUS=PaymentActionNotInitiated&EMAIL=user@example.com&...

但我不知道如何访问返回的信息,在我看来我已经尝试过:

<%= @get_express_checkout_details_response.email %>
<%= @get_express_checkout_details_response.Email %>
and
<%= @get_express_checkout_details_response.EMAIL %>

但似乎没有任何效果。有什么想法吗?

【问题讨论】:

  • 尝试 binding.pry 并查看响应并在此处发布,可能不是对象,可能是哈希或 JSON...

标签: ruby-on-rails ruby paypal paypal-sandbox express-checkout


【解决方案1】:

PayPal 的 gem 使用 SOAP API 并以相应的结构返回结果 - 检查 documentation。例如用户电子邮件 - response.PayerInfo.Payer,送货地址 - response.PayerInfo.Address

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-07-18
    • 2017-04-19
    • 2017-09-12
    • 2014-04-17
    • 2014-04-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多