gpt4 book ai didi

ruby-on-rails - 此交易无效。请返回收件人的网站并重试

转载 作者:太空宇宙 更新时间:2023-11-03 15:49:36 24 4
gpt4 key购买 nike

这是我的 Controller :

setup_purchase 方法适用于我的数据 api,但 preapprove_payment 方法不起作用。

def pay
gateway = ActiveMerchant::Billing::PaypalAdaptivePayment.new(
:login => "email",
:password => "pass",
:signature => "signature",
:appid => "APP-80W284485P519543T" )
response = gateway.preapprove_payment(
:return_url => user_orders_url(current_user),
:cancel_url => user_orders_url(current_user),
:sender_email =>"email",
:start_date => Time.now,
:end_date => Time.now,
:currency_code =>"USD",
:max_amount => "20",
:maxNumberOfPayments => "2")
puts response.preapproval_key
puts gateway.debug
# for redirecting the customer to the actual paypal site to finish the payment.
redirect_to (gateway.redirect_url_for(response["preapproval_key"]))
end

我进入日志:

PA-8K9332086D720151L
{:url=>#<URI::HTTPS:0xdf9bd18 URL:https://svcs.sandbox.paypal.com/AdaptivePayments/Preapproval>, :request=>"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<PreapprovalRequest>\n <requestEnvelope>\n <detailLevel>ReturnAll</detailLevel>\n <errorLanguage>en_US</errorLanguage>\n <senderEmail>email</senderEmail>\n </requestEnvelope>\n <endingDate>2012-07-20T19:09:20</endingDate>\n <startingDate>2012-07-20T19:09:20</startingDate>\n <maxTotalAmountOfAllPayments>20</maxTotalAmountOfAllPayments>\n <maxNumberOfPayments>2</maxNumberOfPayments>\n <currencyCode>USD</currencyCode>\n <cancelUrl>http://localhost:3000/en/u/maserranocaceres/orders</cancelUrl>\n <returnUrl>http://localhost:3000/en/u/maserranocaceres/orders</returnUrl>\n</PreapprovalRequest>\n", :response=>"{\"responseEnvelope\":{\"timestamp\":\"2012-07-20T10:09:22.459-07:00\",\"ack\":\"Success\",\"correlationId\":\"ada6a3e7da93d\",\"build\":\"DEV\"},\"preapprovalKey\":\"PA-8K9332086D720151L\"}"}

完整回复:

#<ActiveMerchant::Billing::AdaptivePaymentResponse:0xc817278 @json="{\"responseEnvelope\":{\"timestamp\":\"2012-07-23T07:43:56.603-07:00\",\"ack\":\"Success\",\"correlationId\":\"7f759c5da73ad\",\"build\":\"DEV\"},\"preapprovalKey\":\"PA-1M101813XU7801314\"}", @response=#<Hashie::Rash preapproval_key="PA-1M101813XU7801314" response_envelope=#<Hashie::Rash ack="Success" build="DEV" correlation_id="7f759c5da73ad" timestamp="2012-07-23T07:43:56.603-07:00">>, @xml_request="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<PreapprovalRequest>\n  <requestEnvelope>\n    <detailLevel>ReturnAll</detailLevel>\n    <errorLanguage>en_US</errorLanguage>\n    <senderEmail>microf_1342709161_per@gmail.com</senderEmail>\n  </requestEnvelope>\n  <endingDate>2012-08-22T16:43:54</endingDate>\n  <startingDate>2012-07-23T16:43:54</startingDate>\n  <maxTotalAmountOfAllPayments>20</maxTotalAmountOfAllPayments>\n  <maxNumberOfPayments>1</maxNumberOfPayments>\n  <currencyCode>USD</currencyCode>\n  <cancelUrl>http://localhost:3000/en/u/maserranocaceres/orders</cancelUrl>\n  <returnUrl>http://localhost:3000/en/u/maserranocaceres/orders</returnUrl>\n</PreapprovalRequest>\n", @request={"PreapprovalRequest"=>{"requestEnvelope"=>{"detailLevel"=>"ReturnAll", "errorLanguage"=>"en_US", "senderEmail"=>"email"}, "endingDate"=>"2012-08-22T16:43:54", "startingDate"=>"2012-07-23T16:43:54", "maxTotalAmountOfAllPayments"=>"20", "maxNumberOfPayments"=>"1", "currencyCode"=>"USD", "cancelUrl"=>"http://localhost:3000/en/u/maserranocaceres/orders", "returnUrl"=>"http://localhost:3000/en/u/maserranocaceres/orders"}}, @action="Preapproval">

我做错了什么?

最佳答案

问题已解决。

改变

gateway.redirect_url_for(response["preapprovalKey"])

gateway.redirect_pre_approval_url_for(response["preapprovalKey"])

正确的方法是redirect_pre_approval_url_for

您可以在这篇文章中看到修复:

preapproved payments with paypal in rails 3.2

非常感谢!

关于ruby-on-rails - 此交易无效。请返回收件人的网站并重试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11584481/

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