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
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