I have to implement Paypal REST API in my rails project(Rails 6) but I am very confused about how to implement it.
While searching it on google I found the below gem but that SDK is deprecated:-
https://github.com/paypal/PayPal-Ruby-SDK
I also tried the below sample but it is also using the 'v1/payments/payment
‘ API which I think has been deprecated:-
https://github.com/yosriady/paypal-rest-sample-app
And I am also confused about the ‘PayPal Checkout v2’ and ‘Active Merchant’. Your help would be greatly appreciated. Thanks in advance.
2
Answers
Did you follow the links in the deprecation notice? The Orders v2 SDK for Ruby is https://github.com/paypal/Checkout-Ruby-SDK
If you are looking for a front-end UI demo pattern to pair with it, use https://developer.paypal.com/demo/checkout/#/pattern/server
This tutorial from May 2020 is promising. It describes "Simple Paypal checkout in Ruby on Rails using Orders API v2".
I implemented it today. It took only a couple of hours, and I can confirm that it works.
I was worried about how to insert the actual order data in the
create_order
action of the tutorial example, but it turns out that the session is available, so I can read mycart_id
etc. from the session.I added
¤cy=EUR&disable-funding=credit,card
to the button script to set the currency and hide the card payment button. I also had to replace ‘USD’ with ‘EUR’ in thecreate_order
action.