11

I'm trying to config my paypal gateway and activemerchant with help of railscasts tutorial but I'm a bit confused because the gateway information has changed.

That's the old config from the tutorial:

gateway = ActiveMerchant::Billing::PaypalGateway.new(
  login: "...",
  password: "...",
  signature: "..."
)

In my PaypalSandbox-Account I just have this:

  1. Endpoint: "..."
  2. Client ID: "..."
  3. Secret: "..."

What's the right config?

crispychicken
  • 2,592
  • 2
  • 33
  • 50

3 Answers3

14

What you need for your gateway are the classic credentials. In order to get your these you have to first create a Paypal sandbox account that will act as your seller. Make sure it is a Business/Merchant type account.

Once you do that then click on the "Profile" link for that account, look under the tab "API Credentials." That will have all the information you need listed.

  1. Paypal API Username
  2. Paypal API Signature
  3. Paypal API Password
rocket scientist
  • 2,427
  • 1
  • 19
  • 28
  • 1
    Yep, it should. Here is the [link](https://developer.paypal.com/webapps/developer/applications) where you can setup your sandbox accounts. – rocket scientist Mar 16 '13 at 20:27
  • 1
    But a Sandbox account means there will be no real processing. How do you transition to a live account using classic credentials? – slowpoison Jul 29 '13 at 20:42
  • 3
    When you are ready to go live you would just use the credentials from your real paypal account instead of the ones from your sandbox account. The credentials can be found in the "My Profile" area under the left hand tab "My Selling Tools" under the option "API access" – rocket scientist Jul 29 '13 at 20:59
1

From scratch testing

First you have to go to Paypal developer's website and create and account

Then generate sandbox user type business then click on Profile option and then click on API Credentials tab you will finally the required data such login/username, password/password, signature/signature

enter image description here

d1jhoni1b
  • 7,497
  • 1
  • 51
  • 37
0
require 'active_merchant'

    ActiveMerchant::Billing::Base.mode = :test
    paypal_options = {
        login: "activemerchant-test_api1.example.com",
        password: "HBC6A84QLRWC923A",
        signature: "AFcWxV21C7fd0v3bYYYRCpSSRl31AC-11AKBL8FFO9tjImL311y8a0hx"
    }
    @gateway = ActiveMerchant::Billing::PaypalExpressGateway.new(paypal_options)


    response = @gateway.setup_purchase(50,
        ip: request.remote_ip,
        return_url: "http://local.mywebdomain.com:3000/mylocalhostpaymentsucceed",
        cancel_return_url: "http://local.mywebdomain.com:3000/seeyouagain",
        currency: "USD",
        allow_guest_checkout: true,
        items: [{name: "Order", description: "Order description", quantity: "1", amount: 50}]
    )
    redirect_to  @gateway.redirect_url_for(response.token)

Another tip is how to set the localhost to local.mywebdomain.com. Just edit the .host file inside system32 folder of your machine as

127.0.0.1 local.mywebdomain.com
zawhtut
  • 8,335
  • 5
  • 52
  • 76