这是一个"现在它正在工作它现在不是"情况 使用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.
这是我的cart.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 %>
我一步一步地经历了一切,但我什么都没得到
答案 0 :(得分:1)
我使用加密按钮从PayPal沙箱中收到相同的错误。我也没有改变我的代码,它在两三个星期前工作。但现在我得到了和你一样的错误。看起来PayPal并不太关心修复他们的Sandbox。他们把优先级放在首位。我建议你和他们一起开票。如果足够的客户抱怨,他们将解决这个问题的唯一方法。