Skip to content

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

SimpleStripe WooCommerce Gateway

SimpleStripe WooCommerce Gateway is a lightweight plugin that adds a Stripe Checkout–based payment method to WooCommerce. It is designed to be clean, self-contained, and easy to customize for personal or commercial projects.

Features

  • Redirects customers to Stripe Checkout using the Stripe PHP SDK.
  • Supports both classic and WooCommerce Blocks checkout flows.
  • Provides test and live secret keys and a webhook signing secret field.
  • Updates WooCommerce order status after successful payment.
  • Includes webhook endpoint validation for Stripe events.
  • Does not send duplicate emails or reprocess payments on refresh.

Requirements

  • WordPress 5.0+
  • WooCommerce 5.0+
  • PHP 7.4 or later
  • Stripe account (for API keys and webhooks)

Folder Structure

simplestripe-woocommerce-gateway/
├── simplestripe-woocommerce-gateway.php
└── assets/
└── js/
    └── blocks.js

Installation

  1. Download or clone this repository.
  2. Copy the simplestripe-woocommerce-gateway folder into wp-content/plugins/.
  3. Activate the plugin from WordPress → Plugins.

Installing Stripe PHP SDK

The plugin relies on the official Stripe PHP SDK. This is not bundled to keep the plugin light. You must install or download the SDK manually before using the plugin.

You have three options:

  1. Use Composer (recommended):
    Run this in your site’s root or any writable directory:
    composer require stripe/stripe-php
    Then set the plugin’s Path to autoload.php to the full path of the generated vendor/autoload.php file.
  2. Download manually:
    Visit Stripe PHP on GitHub, download the release ZIP, and extract it somewhere accessible.
  3. Use a hosted vendor folder:
    You can copy an existing vendor directory from another plugin or project that already includes stripe/stripe-php.

Example full path you might enter in settings: /home/youruser/public_html/vendor/autoload.php

Configuration

  1. Go to WooCommerce → Settings → Payments.
  2. Enable Pay by card (Stripe).
  3. Click the method name to edit settings.
  4. Fill in:
    • Test secret key (sk_test_...)
    • Live secret key (sk_live_...)
    • Webhook signing secret (whsec_...)
    • Path to autoload.php

Webhook Endpoint

Once configured, add this webhook to your Stripe Dashboard:

https://your-site.tld/wp-json/simplestripe/v1/webhook

Supported events:

  • checkout.session.completed
  • payment_intent.succeeded
  • charge.succeeded

Order Status Handling

The plugin safely checks if the target status exists before applying it. You can customize this behavior in your theme or an additional plugin.

add_action( 'woocommerce_payment_complete', function( $order_id ) {
$order = wc_get_order( $order_id );
if ( ! $order ) {
    return;
}

// Only for SimpleStripe
if ( $order->get_payment_method() !== 'simplestripe' ) {
    return;
}

// Safely set to on-hold if available
if ( array_key_exists( 'wc-on-hold', wc_get_order_statuses() ) ) {
    $order->update_status( 'on-hold', 'Stripe payment confirmed.' );
}
});

WooCommerce Blocks

The plugin automatically registers its payment method with WooCommerce Blocks. The file assets/js/blocks.js is loaded only on the checkout page.

Notes

  • Does not include the Stripe PHP SDK - install it manually or with Composer.
  • Webhook verification requires a valid signing secret from Stripe.
  • If you fork this repository, update the REST route and text domain.

License

Open source under MIT

About

SimpleStripe WooCommerce Gateway is a lightweight plugin that adds a Stripe Checkout–based payment method to WooCommerce. It is designed to be clean, self-contained, and easy to customize for personal or commercial projects.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages