1
無法解決PayPal付款響應錯誤或至少警告。我是澳大利亞開發人員(至少我位於澳大利亞並使用澳元作爲貨幣)。資金不足時無法獲取PayPal結帳錯誤
您能否告訴我爲什麼沙箱用戶資金不足,交易對支付請求有正面(有效)回覆?
所以我有user_A誰是買方和seller_user。 user_A有0AUD並且進行20AUD的定期付款交易,並且響應成功?爲什麼?
如何瞭解用戶沒有足夠的資金進行交易?
gem: paypal-recurring
rails: 3.2.14
location: Australia
重定向到URL結帳======控制器動作
ppl = PayPal::Recurring.new(
return_url: paypal_confirm_url(:plan_id => params[:plan_id], :user_id => current_user.id),
cancel_url: paypal_no_checkout_url,
description: "Starter",
amount: 15,
currency: "AUD"
)
response = ppl.checkout
if response.valid?
redirect_to response.checkout_url
else
redirect_to :back
end
====後控制器的動作確認
ppr = PayPal::Recurring.new(
token: params[:token],
payer_id: params[:PayerID],
description: plan.name,
amount: plan.value,
currency: "AUD",
period: :monthly,
start_at: Time.zone.now,
frequency: 1
)
response = ppr.request_payment
if response.errors.any?
flash.keep[:error] = "Something went wrong please contact paypal or ask our development team: [email protected]"
return false
end
response = ppr.create_recurring_profile
paypal_recurring_profile_token = response.profile_id # response.profile_id = nil????
save!
ACK返回成功,無論如何 –
因爲它總是會成功時,顯然。要點是寫你的代碼來驗證這一點,並處理任何其他條件作爲例外。 –
已更新該問題 –