Rails with Paypal Permissions and Paypal Express Checkout

Rails with Paypal Permissions and Paypal Express Checkout

When calling API on behalf of other account, you need to add parameter "subject" to indicate the account that you are calling API for. The value of "subject" could be the account primary email address or payerID. Then the money will go to the account which was the value of subject.

Paypal Express Checkout with ActiveMerchant as in Shopify

We use PayPals "Accelerated Boarding" method of setup for Express. They should send you an email after the first attempted sale with a link that automatically sets up the correct API settings.

To manually set them up, you can follow the instructions listed in our PayPal wiki, http://wiki.shopify.com/PayPal which are as follows:

Third-party authentication: Grant Shopify the appropriate API authentication permissions
1. Log in to your PayPal account and click the Profile subtab.
2. Click the API Access link in the Account Information column.
3. Click the Grant API Permission link.
4. In the Enter an API Partner Username field, enter scott_api1.jadedpixel.com.
5. Check the following API permissions:
* Express_Checkout
* Direct_Payment
* Admin_API
* Auth_Settle
6. Click the Save button.

Best regards,

Mike @ Shopify

Rails: Paypal endpoint /v2/checkout/orders returns http 401

Updated my code by checking the env variable for 'sandbox' or 'live' and then initializing the LiveEnvironment class when we are not in sandbox

  def paypal_init
@env = ENV["PAYPAL_ENV"]
@client_id = ENV["PAYPAL_CLIENT_ID"]
client_secret = ENV["PAYPAL_CLIENT_SECRET"]
if @env == 'sandbox'
environment = PayPal::SandboxEnvironment.new @client_id, client_secret
else
environment = PayPal::LiveEnvironment.new @client_id, client_secret
end
@client = PayPal::PayPalHttpClient.new environment
end

And removed the Authorization header stuff in create_order method

encoded = Base64.strict_encode64("#{ENV["PAYPAL_CLIENT_ID"]}:#{ENV["PAYPAL_CLIENT_SECRET"]}")
request.headers["Authorization"] = "Basic #{encoded}"

It now works

How can I resolve the 10007 - permission denied PayPal API error using the paypal-express gem in ruby on rails

The reason for the PayPal API error was that i needed to call the PayPal GetExpressCheckoutDetails action before checking out the transaction. I did this by adding a line from the paypal-express gem wiki over here: https://github.com/nov/paypal-express/wiki/Instant-Payment

All I needed was paypal_request.details(params[:token])

For Express Checkout, are you required to use the official paypal buttons for checkout?

We use our own buttons on our website and did not have any problems. Buttons are just recommended option for user recognition of familiar button

No Token Passed PayPal Express Checkout in Rails 5

I just found this link it explains how to configure

paypal-express

https://github.com/nov/paypal-express/wiki

paypal_options = {
no_shipping: true, # if you want to disable shipping information
allow_note: false, # if you want to disable notes
pay_on_paypal: true # if you don't plan on showing your own confirmation step
}

request = Paypal::Express::Request.new(
:username => SET_YOUR_OWN,
:password => SET_YOUR_OWN,
:signature => SET_YOUR_OWN
)
payment_request = Paypal::Payment::Request.new(
:currency_code => :JPY, # if nil, PayPal use USD as default
:description => FOO, # item description
:quantity => 1, # item quantity
:amount => 1.00, # item value
:custom_fields => {
CARTBORDERCOLOR: "C00000",
LOGOIMG: "https://example.com/logo.png"
}
)
response = request.setup(
payment_request,
YOUR_SUCCESS_CALLBACK_URL,
YOUR_CANCEL_CALLBACK_URL,
paypal_options # Optional
)
response.redirect_uri

Then you have the ActiveMerchant cofiguration and you can find guides hear:

https://duckduckgo.com/?q=rails+paypal+active+merchant+gem&atb=v52-6_b&ia=qa

How to integrate Paypal with Ruby on Rails

https://spin.atomicobject.com/2011/10/24/integrating-paypal-express-with-rails-3-1-part-1/



Related Topics



Leave a reply



Submit