awsm sid
awsm sid

Reputation: 595

How to implement Paypal Rest API in Rails Application

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.

Upvotes: 1

Views: 2250

Answers (2)

Jussi Hirvi
Jussi Hirvi

Reputation: 735

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 my cart_id etc. from the session.

I added &currency=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 the create_order action.

Upvotes: 1

Preston PHX
Preston PHX

Reputation: 30457

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

Upvotes: 2

Related Questions