I am new to rails and I want to experiment with building a market for buyers and sellers. I want to use paypal ruby adaptive payment sdk gem for this experiment. The github page also provides sample code for setting it up.
require 'paypal-sdk-adaptivepayments'
PayPal::SDK.configure(
:mode => "sandbox",
:app_id => "APP-80W284485P519543T",
:username => "jb-us-seller_api1.paypal.com",
:password => "WX4WTU3S8MY44S7F",
:signature => "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy" )
@api = PayPal::SDK::AdaptivePayments.new
@pay = @api.build_pay({
:actionType => "PAY",
:cancelUrl => "http://localhost:3000/samples/adaptive_payments/pay",
:currencyCode => "USD",
:feesPayer => "SENDER",
:ipnNotificationUrl => "http://localhost:3000/samples/adaptive_payments/ipn_notify",
:receiverList => {
:receiver => [{
:amount => 1.0,
:email => "platfo_1255612361_per@gmail.com" }] },
:returnUrl => "http://localhost:3000/samples/adaptive_payments/pay" })
@response = @api.pay(@pay)
if @response.success?
@response.payKey
@api.payment_url(@response)
else
@response.error[0].message
end
Where would I put my customized version of this code, be it in my OrdersController, applicationController or UserController? I just need some advice.
source
share