How to Accept Stripe Payments in WordPress

Spread the love

If you’re selling something online then you need Stripe. The online encrypted payment system has in many ways surpassed PayPal as the payment system of choice when selling on a website. It’s quick and easy to set up and enables you to offer a wide variety of payment options. But how do you set up a Stripe WordPress site? Let’s check it out.

Content

Accept Stripe Payments on WordPress with WP Stripe Checkout

There are a few plugin possibilities out there but the one I keep coming back to is WP Stripe Checkout. Their optional add-ons cost money but the basic no-frills plugin is absolutely free.

It’s not the most attractive button out there but it does the job. Anyone with basic CSS skills can easily redesign the look of the button.

You first need a Stripe account. Go to Stripe and register for an account. Or sign in if you already have one.

Now install the WP-Stripe Checkout plugin. When you do, you will see a new menu entry on the left-hand side of the WordPress backend. Go to Stripe Checkout -> Settings.

Go back to your Stripe account and head to the API Keys page. Even if you have already set up API keys, they cannot be accessed again for security purposes. So click Create secret key to get another one.

The Publishable key can be copied again, but the secret sauce is in the Secret key. This is the key that unlocks everything and should not be shared with anyone. Therefore it is only accessible once. If you need it again, you have to generate a new one.

Now enter both the Publishable key and the Secret key into the plugin settings page. As you can see, you can also make Test Keys if you want to make a dummy payment first to check if the system works. They can be made from the same API page.

Now choose your currency (in my case, Euros.) You also need to set up Success and Cancel pages on your site. These are pages that the customer will be redirected to once the payment is a success or if it has been canceled.

Verify Front-end Nonces should be ticked and Load Scripts Globally should be not. But the most important part here is to configure the Stripe Webhook URL. Without it, the whole thing falls apart.

Head to the Webhooks page. A webhook is when you receive a notification when your Stripe account registers an event. This can be a sale, a chargeback, a checkout action, and so on.

Copy and paste the Stripe Webhook URL from your plugin settings page and, after clicking Add an endpoint, paste the URL in the Endpoint URL field.

Then click Select events at the bottom. This is where you specify which events you want to be notified about. Click Select all events and then Add events to save.

OK, we’re almost there. The technical stuff is done. Go back to the plugin settings and click the Email tab. First up is the Sale Notification Email, which gets sent to you when you get a sale. Fill in all the fields and be sure to enable the function.

Then it’s the Purchase Receipt Email which gets sent to the customer when they have placed an order. Again, fill in all the details. You can expand on the email to make it much more friendlier and less bland. But leave the shortcodes in place.

It’s now the final stretch. We’re now adding the buttons to the web pages.

Add a WordPress Shortcode block to where you want the button to go.

The basic code to enter into the Shortcode box is:

[wp_stripe_checkout_session name="My Product" price="2.99"]

Swap out My Product with the name of your product, and change the price to whatever price you want. Remember, the currency was already specified in the settings.

You will now see this on your page:

But you can add more. As well as putting <center></center> on either side of the shortcode to center the button, you can also add more to the shortcode for more features. For instance, if you wanted to change Buy Now to something else, then the shortcode would be:

[wp_stripe_checkout_session name="My Product" price="2.99" button_text="Pay Now"]
  • You can specify that a billing address is needed with billing_address=”required”.
  • You can specify if you accept promotion codes with allow_promotion_codes=”true”.
  • If you want their consent to send promotional emails, add consent_collection_promotions=”auto”.

Just add as many as you want – or all of them – to the same shortcode block.

When someone clicks the Buy Now button, they will be taken directly to the Stripe checkout to pay in a pre-filled form. Learn how you can create custom forms in WordPress here.

WP-Stripe Checkout is very flexible. You can make donation buttons, and you can also use it to run a membership site. You can set up recurring payments and redirect paying members to inside the members part of the site.

Add a Stripe Payment Gateway to WooCommerce

The one thing that WP-Stripe Checkout will not do is integrate with WooCommerce. Otherwise, it would be an ideal plugin that covers everything.

The gold standard for WooCommerce is the free official Stripe plugin. It gives all the features of WP-Stripe Checkout, but admittedly shows better buttons.

Other Methods to accept Stripe payments on WordPress

There are two other plugins worth looking at, if the previous two are not to your fancy.

As you can see, there are quite a few options to embed Stripe onto your website. With its cheap processing fees, no setup fees, and no monthly fees, Stripe is fast becoming a firm favorite of e-commerce site owners. Lastly, don’t forget to secure your WordPress site, and don’t forget your SSL certificate!

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time. Subscribe


Mark O’Neill

Mark O’Neill is a freelance tech journalist, editor, and bestselling spy fiction author. Originally from Scotland, he now lives in Germany with his wife and his dog.

Leave a comment