Drupal is a registered trademark of Dries Buytaert

stripe_pay

20 sites No security coverage
View on drupal.org

The Stripe Pay module is a powerful Drupal module that seamlessly integrates the Stripe payment gateway into your website, allowing you to securely process online payments. This module offers an intuitive and flexible solution for implementing Stripe payments with the added convenience of field integration.
We can configure the stripe mode and api configurations from here /admin/stripe-configurations .

This Module is a developer-focused Drupal module designed to streamline and expedite the integration of Stripe payment functionality into your Drupal 9/10 application. This module aims to save developers valuable time and provide the flexibility required to seamlessly incorporate Stripe payments into your website.

Since the module requires an external library, Composer must be used.

composer require "stripe/stripe-php"

This module provides the Stripe Payment field widget. We can add this field to the node and entities where we can add the price value for that product or entity. The price value will be displayed as a button. We can configure the quantity field, price format, button text from the entity manage display. We can configure the mode, currency code and api keys from stripe payment configuration.

Getting started

  • Create a Stripe Account if you don't have one already.
  • Download and install this module with composer require "drupal/stripe"
  • Enter the API keys from your Stripe Account into the Stripe Settings form (admin/stripe-configurations)
  • Add the Stripe Payment field for the entities where you want to implement the stripe payment.
  • Add/update that entity with price value
  • Manage the price info, quantity for that entities from manage display

We can customize the behavior of the stripe_pay service by extending it or implementing hooks provided by this module. The available hooks on this module are:

/**
 * Implements hook_stripe_pay_success_message().
 */
function stripe_pay_stripe_pay_success_message(&$message)
{
    // Modify the success message.
    // $message = 'Success';
}
/**
 * Implements hook_stripe_pay_cancel_message().
 */
function stripe_pay_stripe_pay_cancel_message(&$message)
{
    // Modify the cancel message.
    // $message = 'canceled';
}
/**
 * Implements hook_stripe_pay_success_redirect().
 */
function stripe_pay_stripe_pay_success_redirect(&$redirect_url)
{
    // Modify the success redirect.
    // $redirect_url = ''; //full url
}
/**
 * Implements hook_stripe_pay_cancel_redirect().
 */
function stripe_pay_stripe_pay_cancel_redirect(&$redirect_url)
{
    // Modify the cancel redirect.
    // $redirect_url = ''; //full url
}

We can copy the template file from templates/stripe-payment.html.twig to your theme file and customize the html and implement your own layout with custom css.

Available variables on the twig template:

- stripe_payment_data: Array of related details.
  use {{ stripe_payment_data.price_format }} for price_format
  use {{ stripe_payment_data.currency_sign }} for currency_sign
  use {{ stripe_payment_data.price }} for price
  use {{ stripe_payment_data.currency_code }} for currency_code
  use {{ stripe_payment_data.show_quantity }} for show_quantity to show quantity field
  use {{ stripe_payment_data.title }} for entity title
  use {{ stripe_payment_data.nid }} for entity entity id
  use {{ stripe_payment_data.button_text }} for button_text
  use {{ stripe_payment_data.current_url }} for current_url

Support

Please post bug reports, feature requests and support requests to the Stripe Pay module issue queue.

Demo

Dependencies

Activity

Total releases
2
First release
Jan 2025
Latest release
1 year ago
Release cadence
0 days
Stability
50% stable

Releases

Version Type Release date
1.2.0 Stable Jan 28, 2025
1.2.x-dev Dev Jan 28, 2025