Ruby on rails 是否可以使用sdk gem将账单应用到paypal?
我正在将paypal支付应用到我在rails 5中开发的网站,我正在使用gem“paypal sdk rest”,它对单位支付非常有效,但我需要自动实现月费和年费的会员资格。是否可以使用gem'paypal-sdk-rest'创建会员资格?发送到paypal api的必要参数是什么?这就是我到目前为止所做的:Ruby on rails 是否可以使用sdk gem将账单应用到paypal?,ruby-on-rails,paypal,ruby-on-rails-5,paypal-rest-sdk,paypal-subscriptions,Ruby On Rails,Paypal,Ruby On Rails 5,Paypal Rest Sdk,Paypal Subscriptions,我正在将paypal支付应用到我在rails 5中开发的网站,我正在使用gem“paypal sdk rest”,它对单位支付非常有效,但我需要自动实现月费和年费的会员资格。是否可以使用gem'paypal-sdk-rest'创建会员资格?发送到paypal api的必要参数是什么?这就是我到目前为止所做的: class Paypal::CheckoutsController < ApplicationController include PayPal::SDK::REST de
class Paypal::CheckoutsController < ApplicationController
include PayPal::SDK::REST
def create
payment = Payment.new({
intent: 'sale',
payer: {
payment_method: 'paypal'
},
redirect_urls: {
return_url: complete_paypal_checkouts_url,
cancel_url: line_items_url
},
transactions: [
{
amount: {
total: current_cart.total,
currency: 'USD',
},
description: 'Pago de productos',
item_list: {
items: current_cart.line_items.map(&:to_paypal)
}
},
]
})
if payment.create
redirect_url = payment.links.find{|v| v.rel == "approval_url" }.href
redirect_to redirect_url
else
redirect_to line_items_path, alert: 'Something went wrong, please try later'
end
end
def complete
payment = Payment.find(params[:paymentId])
if payment.execute(payer_id: params[:PayerID]) #return true or false
session[:cart_id] = nil
redirect_to root_path, notice: 'Thanks for purchasing!'
else
redirect_to line_items_path, alert: 'There was a problem processing your payment'
end
end
end
class Paypal::CheckoutsController