Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6901681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:42:13+00:00 2026-05-27T07:42:13+00:00

Doing railscast #143. Code is below. When I add the security stuff, I get

  • 0

Doing railscast #143. Code is below. When I add the security stuff, I get “We were unable to decrypt the certificate id.” in development. When I take the security stuff out, it works peachy again. I’ve redone the whole process a couple times with new certificates and such. No luck.

Any ideas of what to try next?

I’m having exactly the same problem as in this posting, which experienced it in production and it magically started working:

Can't get PayPal Encrypted Website Payments to work in Rails

In “buy these” page:

<%= form_tag "https://www.sandbox.paypal.com/cgi-bin/webscr" do %>
<%= hidden_field_tag :cmd, "_s-xclick" %>
<%= hidden_field_tag :encrypted, @cart.paypal_encrypted("#{@url}/buy_these", payment_notifications_url) %>
<p><%= submit_tag "Buy these for #{number_to_currency(@cart.total_price)}" %></p>

In cart.rb:

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

def paypal_encrypted(return_url, notify_url)
  values = {
    :business => 'seller_1316654707_biz@myurl.com',
    :cmd => '_cart',
    :upload => 1,
    :return => return_url,
    :invoice => id,
    :notify_url => notify_url,
    :cert_id => 'DVFY6JS476MR8'
  }
things.each_with_index do |item, index|
    values.merge!({
      "amount_#{index+1}" => item.price,
      "item_name_#{index+1}" => item.id,
      "item_number_#{index+1}" => item.id,
      "quantity_#{index+1}" => 1
    })
  end
  encrypt_for_paypal(values)
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:42:14+00:00Added an answer on May 27, 2026 at 7:42 am

    I repeated the entire process a few more times, and it started working. Also reviewed each value in a process similar to the next answer. Unfortunately, any time I switch deployment platforms, I seem to run into the same issue. And eventually, it starts working again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Doing an ajax get request works as expected using the following code: $.ajax({ type:
Doing the below will reproduce my problem: New WPF Project Add ListView Name the
I followed the railscast that describes how to get workling running background tasks, but
Doing DJango 1.3 local development using manage.py runserver Created a directory called static in
Doing some 3D stuff in wpf- want to use a simpler test to see
Doing a some practice questions for exam tomorrow can't figure out this one What
Doing some refactoring in some legacy code I've found in a project. This is
Doing some code reviews lately I came across a number of classes that have
Doing this: s = hello s[0] outputs the character code value 104 . What
Doing an expression I get an error, can someone show me the correct syntax

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.