This web payment system integrates Braintree for payment processing using GraphQL. It consists of two main components: ChargesController
for processing user payments and Admin::PaymentsController
for displaying transactions.
![]() |
![]() |
---|---|
Payment1 | Payment2 |
his web payment system is built with Ruby on Rails and Braintree, a popular payment gateway. It allows users to make payments securely and administrators to view transaction details. The system uses GraphQL for communication with the Braintree gateway.
For more in-depth information and best practices on implementing Web Payment System in Ruby on Rails, check out our comprehensive article:
Web Payment System in Ruby on Rails - Best Practices
- User Payment Processing: Users can make payments securely using Braintree.
- Admin Transaction List: Administrators can view a list of successful transactions.
- GraphQL Integration: The system uses GraphQL to communicate with Braintree.
- Ruby on Rails should be installed.
- You need a Braintree account and API credentials.
- Set up your Rails application and configure your database.
Clone this repository to your local development environment:
- Clone the repository:
git clone https://github.com/DeVuDeveloper/payment.git
cd payment
2. Install the required gems:
```bash
bundle install
bin/setup
- Set up the database:
rails db:create
rails db:migrate
rails db:seed
- Set up your Braintree credentials in the .env file(or Rails Credentials):
BRAINTREE_MERCHANT_ID=your_merchant_id
BRAINTREE_PUBLIC_KEY=your_public_key
BRAINTREE_PRIVATE_KEY=your_private_key
- Run the server(Open your Browser and navigate to url: http://localhost:3000/):
bin/dev
The Push Notifications App a linter. You can run the linter with the following command:
rubocop && rubocop -A
To ensure that your web payment system works correctly, follow these testing steps:
-
Install any required testing dependencies if you haven't already.
-
Execute the tests to verify that transactiaons are made and displayed as expected.
rspec spec
ChargesController
The ChargesController
handles user payments. It uses Braintree for processing transactions and GraphQL for communication.
GET /charges/new
: Renders the payment page.POST /charges
: Processes the payment and redirects to a new payment page with a success message if the transaction is successful.
Admin::PaymentsController
The Admin::PaymentsController
is for administrators to view transaction details.
GET /admin/payments
: Lists successful transactions.