Very, nice! I cant wait for the recurrent billing episode :)
Good job!
Is this screencast finally available because of sponsor changed? I know peepcode had screencast on AM and was sponsor of this site - so I guess it was a conflict :)
Very interesting! Much simpler than the gateway I use now. Thanks Ryan!
Does the credit function use PayPal's "refund" operation (where fees are also refunded) or is it seen as another transaction (another set of fees)?
When my project is ready,I will click the "PayPal Donate" here at RailsCasts =)
Activemerchant is a nice library for abstracting away the differences between Gateways.
I second the Paypal donate button increase. I've been watching these for a long time and I never noticed it before.
@Hubert, there wasn't a conflict with PeepCode sponsorship in the past, I just hadn't looked into Active Merchant enough back then to do an episode on it.
AFAIK PeepCode doesn't have a screencast on Active Merchant, but they do have a PDF book which I highly recommend. It's difficult to find adequate documentation on the subject.
@Jeffrey, that's a good question. I know Active Merchant itself provides two ways to handle credits. One is based on an existing transaction, and another is using a credit card number which will be treated as its own separate transaction (payment in reverse).
I'm assuming if you supply the authorization code when issuing the credit, it will treat it as a refund through PayPal but I have yet to test it.
Great stuff Ryan.
As for the donate button - have you ever thought about putting an Amazon wish list together? I think these are better than the donate button since it makes it more personal what people send you and can often result in higher dollar amounts. Just a thought!
I'm also looking forward to an episode on recurring billing!
It's amazing Active Merchant doesn't have a video like this on their homepage! Hope they link to it. Thanks Ryan.
Brian Armstrong
This is so useful to me. I have the Peepcode but seeing coding in action just works for me.
Many, many thanks for it.
@Brian, you can find my Amazon wish list here if you like. :)
http://www.amazon.com/gp/registry/wishlist/1MLM280E2D
Great stuff and great timing! When do you think the next episode will be up! Thank you thank you!
Hi, thanks for another great screencast! I only see one possible problem when using gateway.authorize&capture:
Say you checked on a valid authorize. A few days later you decide to ship the item and do a gateway.capture(...) and during those days between you did the authorize and the capture the shopping client maxed out his credit. What happens then?
Or in other words shouldn't the capture member give back another true/false upon successful completion of the actual funds just as in gateway.purchase?
I should probably read more on active merchand and find the answer myself. Would be nice if you could elaborate on that edge case where the client maxes out his cards between authorize and capture method calls.
Or is authorise(1000, ... ) able to stop the client from going below 10$ of credit when he wants to try and max out because of the dangling authorise made earlier?
Maybe this has been asked/answered a thousand times before, in which I apologize for my ignorance ;)
Yes, Railscasts brings much joy to an otherwise bland Monday morning :)
@Ryan,
I'm pretty sure you are beyond needing "Beginning Ruby". Unless it is a gift for someone else? Sometimes the things you do on your screencasts still look like magic to me, and I've been writing Ruby for a couple of years now.
Awesome screencast Ryan. Any chance on recurring billing for software as a service?
For those of you interested in Rails commerce, you should check out the open source Spree project[1].
[1] http://spreehq.org
@alex same doubt as you.
Would be legal or possible to program a monthly "gateway.purchase" of the same value and same credit card?
@Gustavo,
You have to be careful about storing credit card info in your system (they are many requirements, you can find some info here: http://usa.visa.com/merchants/risk_management/cisp_merchants.html )
The safest way to do reoccurring billing is using something that some providers offer that stores the credit card info on their servers and just returns a sort of key to you that allows you to adjust amounts, remaining payments, etc. I did this for Authorize.net and it was pretty simple.
If you go that route, ActiveMerchant has some methods that make it pretty simple to handle (update_recurring for example). http://github.com/Shopify/active_merchant/blob/2b1c6d8e960b06ac98ea223280ff6e81f30174a1/lib/active_merchant/billing/gateways/authorize_net.rb for reference.
Methods like this are only available if the gateway supports it (and only a few do, and some (all?) charge a bit more for it), so you do have to do some research, but it is worth it if you plan to use reoccurring billing (not every app requires it).
http://wiki.github.com/Shopify/active_merchant/gatewayfeaturematrix
I only have experience with Authorize.net, so I can't speak about the rest, but in general expect another fee every time you turn around ($5/month for reoccurring billing, $5/month as a "statement fee", 2.5%/transaction, $0.20/transaction for this, $0.05/transaction for that, $0.05/transaction for this other thing, $20/month for this, oh, and a $20/month minimum in case that 2.5% is less than that per month, etc. Once you get past that, it's not too bad.
@Jeffrey Lee,
PayPal only supports referenced credits, which are based on a previous transaction. Some other gateways do support non-referenced credits by passing in a credit card object as the second argument to the credit() method. You'll have to check with your gateway provider and ActiveMerchant to see what your gateway supports.
@Louis Vuitton Replica Handbags,
The authorization reserves the money from the customer's card for 3 days. Within the 3 days the funds are guaranteed to be there. You are can capture the funds with PayPal for up to 29 days, but after 3 days the funds are no longer guaranteed. You can attempt to have the funds guaranteed again one time within the 29 days by using the reauthorize() method of the gateway. See the PayPal Website Payments Pro Developer Guide for more info.
@Carl,
You're responsible for those requirements as soon as you receive any cardholder data on your servers even if you don't store the card numbers.
Not storing card numbers does save you from section 3 of the PCI DSS, which is a complex section due to all of the encryption requirements, etc. Not having a load of cardholder data on your servers would also hopefully lessen the impact of a security breach on your servers.
@Cody,
I didn't mean to come across that you didn't have those requirements, but that they become more extensive if you do store the data. Sorry for not making that more explicit (it sounded right in my head at the time).
Is there a way to integrate activemerchant with offline payment via paypal website payments standard?
Hi... it is really nice and good railscasts.. thanks for helping us... i have blogged about this topic..
A big warning: US only at the beginning would be fine. Outside the US there are no gateways integrated in ActiveMerchent and it is the only program I know that has absolutely no documentation (except from the headers - not a single useful line of a comment). So it is absolutely useless for non-US companies. Even if you don't use PayPal as US company you have to guess what class might do the job and try some options, ... - because of the complete lack of documentation.
As great as your screencasts are (I watched them all) - as useless ist ActiveMerchant.
I am looking forward on useful screencasts :)
I am getting some errors like this--"Security header is not valid."
Not sure why I am seeing this, but when I do this exercise I receive the error:
Error: There's an error with this transaction. Please enter a complete billing address.
Did something change in the PayPal API to require billing address? Why did your example work without this information?
fyi, I just posted a screencast on my new SaasRamp plugin for doing recurring billing for software as a service (saas)
http://www.vaporbase.com/postings/SaasRamp_Screencast
Anyone knows if the Activemerchant works with RBSWorldpay ?
So I am trying out your code exactly sans your credentials and I am getting the following error:
Error: There's an error with this transaction. Please enter a complete billing address.
How come it worked in your example?
Same error as 34 & 37
"There's an error with this transaction. Please enter a complete billing address."
I get the same "Please enter a complete billing address", somebody found a solution? may be there is nothing bo ship :S
Try this for the "complete billing address error"
Add the billing_address hash after the ip address.
if credit_card.valid?
response = gateway.purchase(1000, credit_card,
:ip => "127.0.0.1",
:billing_address => {
:name => 'Test User',
:company => '',
:address1 => '123 S Main St',
:address2 => '',
:city => 'Akron',
:state => 'OH',
:country => 'US',
:zip => '44333',
:phone => '(310)555-5555'
}
)
If you get error: There's an error with this transaction. Please enter a complete billing address, you will need to accept the billing agreement on your paypal account (one of the steps in the setup process)
now, more and more and more peopel do a busniess online.it's convenience.
I just setup ActiveMerchant with PayPal Website Payments Pro (US) to do recurring payments for a project I'm working on. If anyone wants to see how I wrapped the PayPal recurring API resources, I posted it all on my blog:
http://blog.matthodan.com/how-to-add-support-for-paypal-website-payment
Good article, Each and every point is good enough.Thanks for sharing with us your wisdom.
why am i getting the following error...
Error: This transaction cannot be processed due to an invalid merchant configuration.
Body exercise machines such as Crazy Fit Massage, Vibration plate machine, Leg Magic, Leg Exerciser, Leg master, Mini stepper, Air climber, Cardio twister;
As a branch factory of China Peteresa Group, Peteresa Fitness Equipment Co.,LTD was established in the year 2008, which is dedicated to design and manufacturer high quality home fitness equipments and machines.
These products are been exporting to Europe, United States, Asia, the Middle East, Russia and Latin America countries. We are expecting more partners from all over the world.
We are now experiencing annual sales turnovers worth in excess of USD 5,000,000. Outputing around 100,000,000 fitness equipment annually, our scientific management and strict operating systems ensure that all items meet the standards required for export into countries worldwide.
I really liked your article and I shared with my friends in my facebook account ..
I gave my site a few examples below. If you appreciate my comments in you enter.
Awesome post! Thanks for sharing such nice information with us. I am really interested in this learning about this. , I feel strongly about information and love learning more on this. Thanks for the information. This is a wonderful post!!
Thanks for sharing your article. I really enjoyed it. I put a link to my site to here so other people can read it. My readers have about the same interets
Discount Wholesale Electronics, Wholesale Cell Phones, Electronic Gadgets and More from the Best Dropship Wholesaler
I feel like I’m often looking for interesting things to read about a variety of subjects, but I manage to include your blog among my reads every day because you have interesting entries that I look forward to. Here’s hoping there’s a lot more great material coming!






