"VALIDATION_ERROR", "detai-6ren">
gpt4 book ai didi

paypal - 从 Rails 应用程序将运输选项发送到 Paypal

转载 作者:太空宇宙 更新时间:2023-11-03 16:31:07 25 4
gpt4 key购买 nike

我无法使用 rest api sdk 将运输选项发送到 paypal

这是@payment.error.inspect

{
"name"=>"VALIDATION_ERROR",
"details"=>[
{
"field"=>"payer.payer_info.phone",
"issue"=>"This field currently not supported in this request" },
{
"field"=>"payer.payer_info.first_name",
"issue"=>"Not valid to specify this field in a request" },
{
"field"=>"payer.payer_info.last_name",
"issue"=>"Not valid to specify this field in a request" },
{
"field"=>"payer.payer_info.email",
"issue"=>"This field currently not supported in this request" },
{
"field"=>"payer.payer_info.shipping_address",
"issue"=>"Not valid to specify this field in a request" }
],
"message"=>"Invalid request - see details",
"information_link"=>"https://developer.paypal.com/webapps/developer/docs/api/#VALIDATION_ERROR",
"debug_id"=>"2139ec6f8c916"
}

当我这样做时:

shipping_address = {
recipient_name: self.order.fullname,
type: self.order.address_type,
line1: self.order.street1,
line2: self.order.street2,
city: self.order.city,
country_code: self.order.country_code,
postal_code: self.order.zip,
state: self.order.state,
phone: self.order.phone_number }
payer_info = {
email: self.order.email,
first_name: self.order.fullname.split(" ").first,
last_name: self.order.fullname.split(" ").last,
phone: self.order.phone_number,
shipping_address: shipping_address }

self.payment = Payment.new({
:intent => "sale",
:payer => {
:payment_method => "paypal",
:payer_info => payer_info },
:redirect_urls => {
:return_url => return_url,
:cancel_url => cancel_url },
:transactions => [{
:item_list => {
:shipping_address => shipping_address,
:items => self.order.order_items.map do |item|
{
:name => _("T-shirts %{size} size") % {size: item.size},
:sku => "item",
:price => self.order.campaign.price_for_size(item.size),
:currency => "HKD",
:quantity => item.count,
:amount => item.price
}
end},
:amount => {
:total => self.order.price,
:currency => "HKD" },
:description => _("This is the payment transaction description.") }]})

self.payment.create
self.payment.error.inspect

我正在使用 paypal-rest-sdk 并且需要将有关买家的信息发送到 paypal 以获得包含地址和买家信息的预填字段。

如何发送到paypal收货地址和payer_info?

最佳答案

当您的 payment_method 是“paypal”时,payer_info 对象是预填充的。 payer_info只在payment_method为credit_card时才需要提交

关于paypal - 从 Rails 应用程序将运输选项发送到 Paypal ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23675809/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com