Stripe Payment Gateway

Navigation: WP Admin > WooCommerce > Settings > Payments > Stripe Payment Gateway

Accept payments via Stripe, including credit/debit cards, Apple Pay, Google Pay, and Link. Supports one-time payments, refunds, and recurring subscriptions.

Stripe Settings

Features

  • One-time and recurring payments
  • Refunds via WooCommerce order screen
  • Stripe Checkout hosted payment page
  • Block checkout support
  • Subscription payment retries

Configuration Fields

FieldTypeDefaultDescription
Enable/DisableCheckboxnoEnable Stripe Gateway.
Integration TypeSelectconnectChoose how to integrate with Stripe: Manual API Keys or Stripe Connect. Only visible if SLSWC_STRIPE_CLIENT_ID is defined.
Stripe ConnectButtonโ€”Connect with Stripe to automatically configure your integration.
Test ModeCheckboxyesPlace the payment gateway in test mode using test API keys.
Test Publishable KeyText(empty)Your Stripe test publishable key. Visible in manual mode.
Test Secret KeyPassword(empty)Your Stripe test secret key. Visible in manual mode.
Test Webhook SecretPassword(empty)Webhook signing secret for test mode.
Live Publishable KeyText(empty)Your Stripe live publishable key. Visible in manual mode.
Live Secret KeyPassword(empty)Your Stripe live secret key. Visible in manual mode.
Live Webhook SecretPassword(empty)Webhook signing secret for live mode.
Statement DescriptorText(site name)Text customers see on their credit card statements (max 22 characters).
CaptureCheckboxyesCapture charge immediately. When unchecked, the charge issues an authorization and will need to be captured later.
Payment MethodsMultiselectcardSelect which payment methods to enable: Credit/Debit Card, Apple Pay, Google Pay, Link by Stripe.
Debug LogCheckboxnoLog Stripe events inside wp-content/uploads/wc-logs/.

Webhook Setup

Configure a webhook in your Stripe Dashboard pointing to:

https://your-store.com/slswc/webhook/stripe/

Copy the signing secret into the Test Webhook Secret or Live Webhook Secret field.

Stripe Connect

If SLSWC_STRIPE_CLIENT_ID is defined in your configuration, you can use Stripe Connect for a simplified setup. Click the Connect with Stripe button to authorize the connection. Once connected, API keys are managed automatically.

Getting Your Stripe API Credentials

If you are using manual API keys (not Stripe Connect), follow these steps:

  1. Log in to the Stripe Dashboard.
  2. Click Developers in the left sidebar, then click API keys.
  3. You will see your Publishable key (starts with pk_test_ or pk_live_) and Secret key (starts with sk_test_ or sk_live_).
  4. Copy the publishable key into the Test/Live Publishable Key field in SLSWC.
  5. Click Reveal test/live key to view the secret key, then copy it into the Test/Live Secret Key field.
  6. For the webhook secret: go to Developers > Webhooks, click Add endpoint, enter your webhook URL (https://your-store.com/slswc/webhook/stripe/), select the events to listen for, and click Add endpoint. Copy the Signing secret (starts with whsec_) into the Webhook Secret field.

Tip: Always start with test mode enabled and test API keys. Only switch to live keys after you have confirmed the integration works correctly with test transactions.

Customising Card Field Styles (Developers)

The data passed to the Stripe checkout script can be changed with the slswc_stripe_elements_options filter. Add an elements_styling key (Stripe Elements style object) and/or an elements_classes key (Stripe Elements classes object) to restyle the card fields:

add_filter( 'slswc_stripe_elements_options', function ( $options ) {
    $options['elements_styling'] = array(
        'base' => array(
            'color'    => '#1d2327',
            'fontSize' => '16px',
        ),
    );
    return $options;
} );

These keys only apply to the separate card number, expiry and CVC fields, which are used when there is no PaymentIntent (for example on the pay-for-order and add-payment-method pages). The main checkout uses the Stripe Payment Element, which has a fixed appearance that these keys don't change. See the Hooks Reference.

Troubleshooting

Payments fail with "No such customer" or "No such payment method"

This usually happens when you switch between test and live mode without updating your API keys. Test-mode customers and payment methods do not exist in live mode, and vice versa. Ensure your API keys match the mode you are operating in.

Webhook events are not being received

  • Verify the webhook URL in your Stripe Dashboard matches exactly: https://your-store.com/slswc/webhook/stripe/ (including the trailing slash).
  • Check that the Webhook Secret field matches the signing secret shown in the Stripe Dashboard for this endpoint.
  • Ensure your server is not blocking incoming POST requests from Stripe's IP ranges.
  • Enable Debug Log and check wp-content/uploads/wc-logs/ for webhook signature verification errors.

Subscription renewals fail with "Invoice payment failed"

  • The customer's payment method may have expired or been declined. Stripe sends a invoice.payment_failed event when this happens.
  • Check the subscription in the Stripe Dashboard to see the specific decline reason (insufficient funds, card expired, etc.).
  • SLSWC will automatically retry the payment based on your retry settings. You can also retry manually from the Stripe Dashboard.

"Statement descriptor is invalid" error

The statement descriptor must be 22 characters or fewer and can only contain letters, numbers, and certain special characters. Remove any unsupported characters from the Statement Descriptor field.

Was this article helpful?