Pay.JP Solution when it can be done locally but it does not work well in the production environment

I was worried about a week and solved it Keep in mind why Pay.PJ works well in the local environment but cannot be settled in the production environment. The reason why Pay.JP payment was not successful was that it took a long time because no error message was displayed ...

Operating environment ruby 2.6.5 Rails 6.0.3.2 heroku 7.42.13

Cause of error

The cause of the error can be summarized briefly. ** Environment variables set on Heroku were not reflected in the production environment ** Is the cause

I will explain what that means. At the terminal

set PAYJP_PUBLIC_KEY='Your own test public key'


 When

#### **`set PAYJP_SECRET_KEY='Your own test private key'`**
```heroku config

 I think you will be entered.
 Whether or not you can input properly
```heroku config```
 You can check it by checking at.
 ** When I check it, it's firmly in it. ** **
 ** It's in! !! ** **
 I was deceived by this ...
 I changed the contents of Heroku's environment variables, but I haven't adapted to them yet. ..

# How to adapt Heroku environment variables
 I will tell you from the conclusion
```git push heroku master```
 This will push the GitHub master, apply environment variables and make payments even in production.
 But some
```everything up-to-date```
 I think that some people will come back if they are already up to date. I was the same.
```git commit --allow-empty -m "Empty commit" ```
 In such a case, enter this to bring the GitHub master up to date again.
```git push heroku master```
 please try!
 I'm sure it can be solved

 Thank you for visiting.


Recommended Posts

Pay.JP Solution when it can be done locally but it does not work well in the production environment
An example of a small work when you want to divide the definition value according to the environment but do not want to be aware of it
"Do not show again" check does not work in the warning dialog when starting applet
[Error] The app is not displayed in the production environment
Hivernate Validator does not work in WAS Liberty environment
[Ruby on Rails] credential does not work in production environment even though I saved production.key
When a breakpoint is set in IntelliJ IDEA but it does not stop in debugging [Gradle]
Error in production environment (The asset "~" is not present in the asset pipeline.)
Docker does not work when DOCKER_HOST is specified in WSL2
Correspond to "error that basic authentication does not pass" in the test code "The story that could not be done"
It should be the same as the sample when logging in to Twitter, but an error occurs ~ resolution
An active hash that can be treated as data even if it is not in the database
Puma --Nignx is an escape route when rails s -e production -d doesn't work in the environment
What I checked when I installed Docker Hub in a Windows 10 home environment but it did not start
Settings that should be done when operating a production environment with Rails
[Rails] About the error that the image is not displayed in the production environment
When the form such as Select of Materialize does not work properly
If the JDK version is correct in Eclipse but an error occurs or the compiler does not work properly
A solution to an error that makes you angry that you are not following the MySQL default setting ONLY_FULL_GROUP_BY in a production environment and it is not unique.