In my last post, I introduced using Stripe with Grails to process credit cards. I guess I should have waited to write that post though because today I made it a lot easier, ha! :)

As of the 1.0.M6 release, the plugin has a new tag library that takes care of all the JavaScript and credit card input fields for you! This is all that’s required now to create the form:

A couple notes about this code compared to my previous post’s code:

  • You no longer need to declare the resource module stripe, the plugin takes care of this.
  • You no longer need to worry about setting the publishableKey, the plugin takes care of this now too.
  • <stripe:script formName=”payment-form”/> is required to setup all the JavaScript. The formName attribute needs to match the name attribute on your <g:form> tag.
  • <stripe:creditCardInputs cssClass=”form-row”/> is optional if you want the plugin to create the credit card fields (number, cvc, exp-month & exp-year). The cssClass attribute is what class you want the plugin to put for the div tag surrounding each credit card field. You don’t have to use this though and can include these fields manually in your form if you’d prefer.

This will all be covered in the plugin documentation which will be done with the 1.0 final release. Thanks to those who already provided feedback! Please let me know what you think of these new updates as well as any other features you’d like included!

Also, a quick note that I forgot to mention about Stripe in my last post is that you can accept payments from any country (Visa, MasterCard, American Express, Discover, JCB, and Diners Club cards) and customers can use pretty much any currency, but you currently have to be based in the US to receive payments. Sounds like they are working to expand to other countries though. Check out their FAQ for more information.

3 comments so far

Add Your Comment
  1. […] Using Stripe with Grails Continued […]

  2. […] Using Stripe with Grails Continued […]

  3. Thanks for introducing me to Stripe! I’m definitely looking into using your plugin.