[英]PayPal Parameters for Item Detail, Sales Tax and Shipping in Adaptive Payments
我有一個正在構建的 Rails (3.0, Ruby 1.9.2) 應用程序,訪問者可以從我的用戶那里購買東西(付款直接從買家到用戶)。 我正在嘗試使用 PayPal Adaptive Payments 來實現這一點,但是,我不知道我該怎么做:
我試過了:
這是我當前的代碼:
gateway = ActiveMerchant::Billing::PaypalAdaptivePaymentGateway.new( :login => "foo",:password => "bar", :signature => "foobar",:appl_id => "foobar1" )
ss= gateway.pay amount.to_i, @user.paypal_account,
:ip => request.remote_ip,
:sender_email => params[:paypal_email],
:return_url =>"http://#{current_subdomain}.foobar.com/product/#{params[:product_id]}",
:cancel_url => request.referer,
:client_details =>
{
:application_id => '60',
:customer_type => 'user',
:customer_id => '12',
:tracking_id => tracking_id,
:pay_key => '24',
:ipn_notification_url => "http://foobar.com/paypal_ipn"
}
該代碼用於獲取付款信息,它主要不會像我想要的那樣顯示(項目名稱/描述顯示為收件人,@user.paypal_account - 如果可能的話,我想細分金額以顯示運費和稅)。
自適應支付在常規結帳頁面中不支持此功能。
這是我的代碼(我正在使用 paypal_adaptive gem)
我指定了更多參數,它可能會有所不同,因為您使用的是 ActiveMerchant 的 paypal 類:
pay_request = PaypalAdaptive::Request.new
server="http://mybaseurl.com"
data = {
"returnUrl" => "#{server}/sales/summary?sale_id=#{sale_id}",
"requestEnvelope" => {"errorLanguage" => "en_US"},
"currencyCode"=>"USD",
"receiverList"=>{"receiver"=>[{"email"=>"#{@sale.seller.email}","amount"=>"item amount"}]},
"cancelUrl"=>"#{server}/payments/canceled_payment_request?sale_id=#{sale_id}",
"actionType"=>"PAY",
"ipnNotificationUrl"=>"#{server}/payments/ipn_notification",
"feesPayer"=>"EACHRECEIVER",
"memo"=>"Purchase for item from my company",
"reverseAllParallelPaymentsOnError"=>"true",
"trackingID"=>"#{sale_id}",
"partnerName"=>"Pretty sure this is the top line in paypal"
}
@pay_response = pay_request.pay(data)
因此,上面的 partnerName 是您可以指定為您的應用程序的第一行
至於銷售稅,論壇上有一個很長的話題……我不確定那個……也許你必須在你的 paypal 個人資料中設置它,你收取銷售稅,或者在得到你的總數之前計算正在詢問買家,並在摘要屏幕上讓他們明白。 論壇主題
此外,這里還有更多您可能沒有看到的文檔,因為他們在 x.com 上組織了一半文檔,然后在 cms.paypal.com 上組織了更多文檔... https://www.x.com/developers/paypal/documentation-tools /api/支付-api-操作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.