
Security News
Researcher Exposes Zero-Day Clickjacking Vulnerabilities in Major Password Managers
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Payfast is a Ruby gem that simplifies the process of integrating the PayFast payment gateway into your Ruby on Rails application. It provides a generator that helps scaffold the necessary configuration, routes, models, and controllers required to integrate PayFast seamlessly.
Add this line to your application's Gemfile:
bundle add payfast
rails generate payfast:install
insert config/routes.rb
create app/controllers/carts_controller.rb
create app/views/carts/index.html.erb
create app/views/carts/make_payment.html.erb
create app/helpers/carts_helper.rb
create db/migrate/20230824105530_create_carts.rb
create config/payfast.yml
create app/models/cart.rb
insert app/views/layouts/application.html.erb
insert config/environments/development.rb
Setup payfast credentials for your environment
rails EDITOR="code --wait" bin/rails credentials:edit
This will allow you to securely edit and store your credentials. once you save and exit the file, the credentials will be encrypted and can only be accessed withe rails master key.
payfast:
merchant_id: {your_merchant_id}
merchant_key: {your_merchant_key}
passphrase: {{your_passphrase}}
payfast.yml config fileRails.application.credentials.payfast.merchant_id and wrap it in erb tags as instructed in the comments.Update the make_payment.html.erb as instructed in the file. it should look like so:
<script>
// set the uuid to uuid = @cart.payment_uid. surround @carts.payment_uid with erb tags
const uuid = `<%= @cart.payment_uuid %>`
window.payfast_do_onsite_payment({uuid}, function (result) {
if (result === true) {
// redirect success_path(@cart)
window.location.href = `<%= success_cart_path(@cart) %>`
}
else {
// Redirect to failure_path(@cart)
window.location.href = `<%= failure_cart_path(@cart) %>`
}
});
</script>
your rails development config has was modified by the generator to allow ngrok hosts to hit your rails server
config.hosts << /[a-z0-9-]+\.ngrok-free\.app/
Thank you for considering contributing to our project! We welcome contributions from the community to help improve this project and make it better for everyone.
If you encounter any issues or bugs while using our project, please open a new issue on GitHub. Please make sure to include detailed information about the problem, steps to reproduce it, and the environment in which you encountered it.
We encourage pull requests from the community! If you have an improvement or new feature you'd like to contribute, please follow these steps:
We will review your pull request as soon as possible and provide feedback if needed. We value your contributions and will work with you to ensure your changes are integrated smoothly. d
Your contributions are essential to the success of this project, and we are grateful for your help in making it better for everyone. If you have any questions or need further assistance, feel free to reach out to us.
Happy coding!
FAQs
Unknown package
We found that payfast demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers

Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.

Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.