简体   繁体   中英

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.

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 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM