Create Stripe Account on https://stripe.com/

The First step is to create an account on Stripe. All you need to do for this is to fill out a form and then confirm the account via Email.

API Keys

After confirming your account via Email, you can find your Stripe API Keys in “Developers > API Keys” from the navigation menu.

https://dashboard.stripe.com/account/apikeys

You will find 2 types of keys there:
a. Publishable Key: pk_test_xxx… //{PUBLISHABLE_KEY}
b. Secret Key: sk_test_xxx… //{SECRET_KEY}

Publishable Key is like a public key. This key can be shared with anyone and will also be printed on your HTML Page in a hidden input field.
Secret Key is not for Public. This key should not be shared with anyone and not be printed anywhere on pages visible to Users.
To view live keys, you need to activate your account via “Activate Your Account” from the navigation menu.

https://dashboard.stripe.com/account/details

Add Dependencies

Grails:

Maven:

Repository:

Front End Code – using Custom Form (HTML + JavaScript)

index.gsp

Back End Code (Grails)

StripeController.groovy

Response

Response from stripe.createToken()

This response is returned by Stripe.js on index.gsp when we call the method stripe.createToken() in Javascript.

Response from Customer.create(customerparams)

This response is returned by Stripe in Controller when we call the method Customer.create(customerparams)