Easy steps for Stripe Integration with Grails.

This blog will help you to integrate stripe in your grails application.

Step 1) Create an account on Stripe.

Step 2) Get your secretKey and publishableKey from the Stripe Account .


and set the api key in Config.groovy


Step 3) Include stripe.js on the application

Step4) Add these lines on your pom.xml


or manually add following jars on your lib

1) stripe-java-latest.jar.

step 5) Now you need to include form on your page. Ref

<form action="" method="POST" id="payment-form">
  <span class="payment-errors"></span>

  <div class="form-row">
      <span>Card Number</span>
      <input type="text" size="20" data-stripe="number"/>

  <div class="form-row">
      <input type="text" size="4" data-stripe="cvc"/>

  <div class="form-row">
      <span>Expiration (MM/YYYY)</span>
      <input type="text" size="2" data-stripe="exp-month"/>
    <span> / </span>
    <input type="text" size="4" data-stripe="exp-year"/>
<div class="form-row">
      <input type="text" size="20" data-stripe="amount"/>

  <button type="submit">Submit Payment</button>

You can change form as your requirements.

Step 6)If all configuration was going well, on form,s submit button click, Stripe send a request to stripe server with card data and on response you get a Stripe token(if card is valid else send stripe card validation error message). Now this stripe token is used to make transaction through Stripe.

Step 7) On server side of your application you use following code to make your first Stripe request for making payment.

Stripe.apiKey = grailsApplication.config.grails.plugins.stripe.secretKey
Map chargeParams = ["amount":params.amount,"card":params.stripeToken]


For more information please follow the stripe documentation.