Accepting Stripe payments

I want to accept one-off and subscription payments from my CP site. I have in the past been using FormCraft plugin and the Stripe add-on but they recently moved to a hosted-only option. I would prefer a plugin.

I don’t really need ClassicCommerce or similar. Just a plugin that will allow me to accept Stripe payments.

Does anyone have a recommendation?

Has anyone implemented such a thing in functions.php using the Stripe API?

Thanks

Jeremy

I have built an integration with the Stripe API that I’ve been using successfully for about 6 years.

I’ve also recently built an integration for subscriptions too.

I don’t have either available as a plugin at the moment, but I’d be happy to help if you can provide some more details.

1 Like

WPForms lite allows exactly what you need also, in addition to the plugin that Tim developed. It works on CP.

2 Likes

Thanks Tim. I’m not very experienced at functions.php, though I have done a bit of modification and do understand php a bit. Would you be willing to share your code (without your specific details, obvs) so I can at least try to understand Stripe’s instructions in context?

Thanks Elisabetta. I’ll look at that plugin now.

1 Like

I have done this using the native Stripe pricing tables, it’s an embedded script. I do not know if it matches your requirements.

See a screenshot below, from one of my websites -

And another screenshot from a friend -

I’m not sure if you still want the “full code” answer. But, if you do, the first step is to download the Stripe SDK and then upload it your site. I like to upload it to just outside the web root (i.e. within the www folder but not within the html subfolder) so that (a) it isn’t accessible from the web and (b) I can use just the one SDK from all the subsites within the same domain.

The next step is to get two pairs of keys from Stripe. (Obviously, you need a Stripe account.) One pair will be (a) a secret key and (b) a public or publishable key for testing, and the other pair will be (a) a secret key and (b) a public or publishable key for live sites.

Next, you have to decide where you want to store these key pairs. One option is in a file (e.g. the wp-config.php file); the other is in the database. I prefer to do the latter because then I can create an admin page under the Settings menu, where I can input the keys (and input new ones if I change them) and where I can also switch between having the site in test or live mode.

Then you need to create a file in the mu-plugins folder. Don’t use the functions.php file, because (a) you’ll lose all the code if you change themes and (b) the mu-plugins folder loads earlier, so you can guarantee that it’s ready whenever someone completes a form on your site. If the folder doesn’t currently exist, you’ll need to create it.

Then you’ll need to create a registration and payment form, and then you’ll need to write a function to process that form. Don’t forget to check that every field has been filled correctly, and to unslash and sanitize all inputs!

I’m guessing that now you’ll be happier with one of the previous low- or no-code options, so I’ll stop there!

1 Like

Well, thank you for the outline and yes, I think I am going to go with a no/low code option, probably WPForms Lite

The good news is that Buttondown tells me I don’t need to do anything to ensure people who subscribe to my newsletter from my site (as opposed to direct on Buttondown) receive paid status among newsletter subscribers.