Add the following dependency in BuildConfig.groovy. Make sure to use the latest version as the API keeps changing from version to version.

runtime 'com.stripe:stripe-java:1.33.0'

Add html form and javascript code in your gsp page with proper field names provided by stripe. Sample code can be downloaded from stripe’s website. The Javascript will first generate a token that represents the credit card information. If a token is generated successfully, a hidden input is appended with stripe token as its value.

if (response.error) {
// Show the errors on the form
$form.find('.payment-errors').text(response.error.message);
$form.find('button').prop('disabled', false);
} else {
// response contains id and card, which contains additional card details
var token = response.id;
// Insert the token into the form so it gets submitted to the server
$form.append($('<input type="hidden" name="stripeToken" />').val(token));
// and submit
$form.get(0).submit();
}

Now the form should be submitted to our server(not to be confused with stripe server).