Paypal micropayments?

86 views
Skip to first unread message

Denis Haskin

unread,
Mar 12, 2012, 5:13:28 PM3/12/12
to activemerchant
Has anyone successfully used Paypal micropayments with the PaypalExpressGateway?  The Paypal documentation is quite confusing on this matter, and actually getting signed up requires you to go through a labs site that doesn't even work in many browsers.  Now it seems like Paypal's pushing their digital goods program, but that seems to be a pretty radical change (and I assume not yet integrated with ActiveMerchant?).

I don't want to do anything fancy or have to do their new "in-context" checkout.  I just want to get the micropayments fee schedule applied to my transactions.  I asked them to enable it for my test account, and they responded and said they did.

Has anyone successfully gotten micropayments transaction pricing to work?

Thanks,

--
Denis Haskin


tamouse pontiki

unread,
Feb 3, 2014, 11:46:24 AM2/3/14
to activem...@googlegroups.com
This is nearly 2 years old and no one has responded, which tells me things are not a lot better. I'm just starting out with this. My client really wants to use Paypal Digital Goods Micropayments as their transactions are well under two dollars. The additional complication being that these are a monthly subscription so they will be recurring payments. I'm adrift in the morass of trying to understand how paypal works, how active merchant works, and while everyone I've talked to says "use active merchant" I'm not finding much in the way of information on this specific use case.

I see in the API for active merchant that there is a Paypal Recurring Payments, and I think it can be wired into Paypal Digital Goods, but I'm lacking that one documented example.

I really need a crash course in this. What should I look for? The Peepcode PDF by Cody says *explicity* it does not cover recurring payments; I'm not sure if it covers micropayments either. What other sources are there that can help me understand this quickly?

Chris Irish

unread,
Feb 4, 2014, 1:09:02 AM2/4/14
to activem...@googlegroups.com
Unpack the gem and look at the source for examples.  You'll see how all the other adapters for all the other supported payment gateways are created/used.  They're all unique in their implementation for each api but they all follow the same general pattern.

tamouse pontiki

unread,
Feb 6, 2014, 2:05:31 PM2/6/14
to activem...@googlegroups.com
So digging through the gem, looking at examples, and all that, I tried creating the following test:

#!/usr/bin/env ruby
require 'active_merchant'
require 'yaml'
require 'logger'

logger = Logger.new(STDOUT)

CONFIG = YAML.load(File.read(
    File.expand_path("../paypal_api_signature.yml")
    ))

ActiveMerchant::Billing::Base.mode = :test
GATEWAY = ActiveMerchant::Billing::PaypalDigitalGoodsGateway.new(
  :login => CONFIG['API_Username'],
  :password => CONFIG['API_Password'],
  :signature => CONFIG['Signature']
  )

CC = YAML.load(File.read(
    File.expand_path("../paypal_test_credit_card.yml")
    ))

credit_card = ActiveMerchant::Billing::CreditCard.new(
  :first_name => CC['first_name'],
  :last_name => CC["last_name"],
  :number => CC["number"],
  :month => CC["exp_month"],
  :year => CC["exp_year"],
  :verification_value => CC["cvv"]
  )

if credit_card.valid?
  amount = 200                # two dollah
  options = {
    :period => "Month",
    :frequency => 1,
    :start_date => Date.today,
    :description => "Monthly Brewtoad Subscription"
  }
  
  logger.info "Calling GATEWAY.recurring to create recurring profile"
  logger.info "Amount: #{amount.inspect}"
  logger.info "Credit Card: #{credit_card.inspect}"
  logger.info "Options: #{options.inspect}"
  
  recurring_profile = GATEWAY.recurring(
    amount,
    credit_card,
    options
    )
  
  if recurring_profile.success?
    logger.info "Successfully charged %.2f to the credit card %s" % [ (amount.to_f / 100.0), credit_card.display_number ]
  else
    logger.error "Charge failed: #{recurring_profile.message}"
  end

else
  logger.error "Invalid credit card"
end

which produces this output:

I, [2014-02-06T13:02:42.811436 #3332]  INFO -- : Calling GATEWAY.recurring to create recurring profile
I, [2014-02-06T13:02:42.811506 #3332]  INFO -- : Amount: 200
I, [2014-02-06T13:02:42.811547 #3332]  INFO -- : Credit Card: #<ActiveMerchant::Billing::CreditCard:0x007fa9d3aa07d8 @first_name="Tamara", @last_name="Temple", @number="4928841618325417", @month=2, @year=2019, @verification_value="111", @errors={"number"=>[], "brand"=>[]}, @brand="visa">
I, [2014-02-06T13:02:42.811613 #3332]  INFO -- : Options: {:period=>"Month", :frequency=>1, :start_date=>Thu, 06 Feb 2014, :description=>"Monthly Brewtoad Subscription"}

/Users/tamara/.gem/ruby/2.0.0/gems/activemerchant-1.42.4/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb:128:in `block (3 levels) in build_create_profile_request': undefined method `add_credit_card' for #<ActiveMerchant::Billing::PaypalDigitalGoodsGateway:0x007fa9d3aa3528> (NoMethodError)
from /Users/tamara/.gem/ruby/2.0.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
from /Users/tamara/.gem/ruby/2.0.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
from /Users/tamara/.gem/ruby/2.0.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
from /Users/tamara/.gem/ruby/2.0.0/gems/activemerchant-1.42.4/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb:125:in `block (2 levels) in build_create_profile_request'
from /Users/tamara/.gem/ruby/2.0.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
from /Users/tamara/.gem/ruby/2.0.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
from /Users/tamara/.gem/ruby/2.0.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
from /Users/tamara/.gem/ruby/2.0.0/gems/activemerchant-1.42.4/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb:123:in `block in build_create_profile_request'
from /Users/tamara/.gem/ruby/2.0.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
from /Users/tamara/.gem/ruby/2.0.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
from /Users/tamara/.gem/ruby/2.0.0/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
from /Users/tamara/.gem/ruby/2.0.0/gems/activemerchant-1.42.4/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb:122:in `build_create_profile_request'
from /Users/tamara/.gem/ruby/2.0.0/gems/activemerchant-1.42.4/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb:31:in `recurring'
from ./test.rb:46:in `<main>'


So what am I missing here? How do I tell Paypal to use the credit card the user enters for our monthly subscription digital good?

Paypal documents are useless here; I cannot make heads or tails of them to do what we need to do.
Reply all
Reply to author
Forward
0 new messages