尝试通过PayPal创建付款时出现内部服务器错误



这是一个"现在它正在工作现在它不是"的情况沙盒PayPal一切正常,现在它给了我以下错误

Internal Server Error
The server encountered an internal error or misconfiguration and was unable 
to complete your request.
Please contact the server administrator, webmaster@paypal.com and inform 
them of the time the error occurred, and anything you might have done that 
may have caused the error.
More information about this error may be available in the server error log.

这是我的购物车.rb

def paypal_url(return_url,notify_url)
  values = {
    :business => 'seller5@myseelingwebsite.com',
    :cmd => '_cart',
    :upload => 1,
    :return => return_url,
    :invoice => id,
    :notify_url => notify_url,
    :cert_id => "4VA2YEE757V8A"
  }
  shopping_cart_items.each_with_index do |item, index|
    values.merge!({
      "amount_#{index+1}" => (item.price_cents/100),
      "item_name_#{index+1}" => Product.find(item.item_id).name,
      "item_number_#{index+1}" => item.item_id,
      "quantity_#{index+1}" => item.quantity
    })
  end
  encrypt_for_paypal(values)
end
PAYPAL_CERT_PEM = File.read("#{Rails.root}/certs/paypal_cert.pem")
APP_CERT_PEM = File.read("#{Rails.root}/certs/app_cert.pem")
APP_KEY_PEM = File.read("#{Rails.root}/certs/app_key.pem")
def encrypt_for_paypal(values)
  signed = OpenSSL::PKCS7::sign(OpenSSL::X509::Certificate.new(APP_CERT_PEM), 
                                OpenSSL::PKey::RSA.new(APP_KEY_PEM, ''), 
                                values.map { |k, v| "#{k}=#{v}" }.join("n"), 
                                [], 
                                OpenSSL::PKCS7::BINARY)
  OpenSSL::PKCS7::encrypt([OpenSSL::X509::Certificate.new(PAYPAL_CERT_PEM)], 
                          signed.to_der, 
                          OpenSSL::Cipher::Cipher::new("DES3"), 
                          OpenSSL::PKCS7::BINARY).to_s.gsub("n", "")
end

我的重定向视图

<%= form_tag "https://www.sandbox.paypal.com/cgi-bin/webscr", :id => 
'checkoutform' do %>
  <%= hidden_field_tag :cmd, "_s-xclick" %>
  <%= hidden_field_tag :encrypted, 
  @cart.paypal_url("http://www.mywebsite.com", 
  payment_notifications_url(:secret => "secretcode")) %>
<% end %>
我一步

一步地经历了一切,我一无所获

我从带有加密按钮PayPal沙箱中收到相同的错误。 我也没有更改我的代码,它在两三周前就可以工作了。 但是现在我得到了和你一样的错误。 看起来PayPal不太关心修复他们的沙盒。 他们对此的优先级较低。 我建议你和他们开一张票。 如果有足够多的客户抱怨,他们将解决这个问题的唯一方法。

相关内容

  • 没有找到相关文章

最新更新