How to integrate 2checkout payment gateway in ruby

514 views Asked by At

In my application I wish to integrate 2Checkout payment gateway in ruby application with my sandbox account. I need to change https://www.2checkout.com/checkout/purchase this url to 'https://sandbox.2checkout.com/checkout/purchase' how can I change that and how to give MD5_HASH in my application

please some body help me

2

There are 2 answers

0
Harshith Prasad On BEST ANSWER

I have solved this issue by just creating a config/initializers in that 2checkout.rb and mentioned there a single line i.e

Twocheckout::Checkout.sandbox(true);

By this we can redirect to URL of sandbox.2checkout.com from your test account

If you are using 2checkout sandbox account for test integration in ruby application you have follow the above else you may get error of PE:101 when ever you try to redirect from your cart to 2checkout website

This error take place due to when you does not mention sandbox(true) it will consider as live application and it tries to redirect to live site this is reason for giving sandbox(true) if you want to test through sandbox account

Hope this is will help you

0
wtrmLn On

The information you are seeking can be found here: https://www.2checkout.com/documentation/payment-api/create-token

I have already set the language to Ruby for you(you can change it back and forth in the upper right hand corner), and if you scroll down just a bit you will see "Include 2co.js on your Checkout Page" - This is where you specify which environment you are wishing to work / test in.

The TCO.loadPubKey('', function() { }); is where the environment is specified. You would either use TCO.loadPubKey('production', or TCO.loadPubKey('sandbox',

Regarding the MD5_Hash - Please go here: https://www.2checkout.com/documentation/notifications/

That URL is also in the documentation for developer section of our website, you will also see many other categories on the left hand side that will provide all of the resources you need to integrate 2CO with your website.