DEV Community

BoTree Technologies
BoTree Technologies

Posted on • Originally published at botreetechnologies.com on

How to Integrate PayUMoney in your Spree Commerce Store with RoR?

Integrate PayUMoney in your Spree Commerce Store

What is a Payment Gateway?

A payment gateway is a merchant service provided by an eCommerce application service provider to authenticate and process payments via various payment modes.

It plays the role of the third party that securely transfers money from your bank account via any payment mode to the merchant’s payment portal. An eCommerce web development company can assist you in integrating a payment gateway with your online store.

Various examples of payment gateways: PayUMoney, Stripe, PayPal, etc.

Why PayUMoney?

PayUMoney international payment gateway is India’s leading payment gateway with 4,50,000+ merchants in India with over 100+ payment methods. It allows payment with just a single tap. It is a trusted, instant, and most secure payment gateway.

It also provides features like Auto OTP reader, saved cards and transaction management on the merchant’s dashboard. It also allows paying via credit cards, debit cards, UPI, net banking, wallets, etc.

It supports international payments with multi-currency support including Indian currency too.

Isn’t it amazing, right!!

You can also refer to the Developer Guide here.

Now, let’s see how we can integrate PayuMoney with Spree Commerce development.

Read more: Integrate Stripe Payment Gateway in Spree Commerce

How to Integrate it into the Spree store?

PayU provides 2 ways to integrate web checkouts with an eCommerce store.

  1. Redirect Checkout
  2. BOLT Checkout

ReDirect Checkout:

It is a quick and easy way to integrate payment checkout. It also allows us to accept payments via credit/debit cards, net-banking, UPI, wallets.

Why ReDirect checkout?

  1. Requires a few lines of code
  2. No PCI-DSS Compliance Required
  3. Mobile-Friendly checkouts

Pre-requisites:

  1. Sign up to Payu
  2. The merchant and salt keys are available on the merchant’s dashboard.

Configurations to Spree Store:

  1. Adding payment gateway to spree store
  • Add your payment gateway to the app/models/spree/gateway as payu_in_gateway.rb .
  • Configure the gateway to the spree store in spree.rb.
  1. Create a payment method for the gateway configured.
    • Login as admin.
    • Go to Configurations > Payment Methods and visit New Payment Method.
    • Add the payment method as shown in the below screenshot:

Configurations payment methods

  1. Add a blank partial for the PayU payment method in the path app/views/spree/checkout/payment/_payu_in.html.erb

  2. You can now see your payment method on the frontend in the standard checkout process as shown below:

Standard checkout process

Note: Don’t forget to add the keys i.e. merchant key and salt key available on the merchant’s dashboard in the payment method we created above.

Now, if we click on the Save And Continue button it should pay with PayU, Right?

To send the payment request to PayUMoney ensure that you have valid credentials i.e. valid merchant key and salt that are available on the merchant’s dashboard, set the request parameters as it requires and handle the response as per the requirement.

The post How to Integrate PayUMoney in your Spree Commerce Store with Ruby on Rails? appeared first on BoTree Technologies.

Top comments (0)