Integrating a new payment provider can be daunting, and the official documentation unneccesarily complex. Here are four easy steps to a complete Stripe integration.

Note that you don’t technically need an SSL certificate to be compliant, as the form itself is secured by Stripe, but we would highly recommend the purchase of at least the basic certificate, if only for customer confidence.

Step 1

Download the latest SDK from here https://github.com/stripe/stripe-php/releases and upload to your server. You don’t need the “test” folder.

Step 2

Create a config file to include Stripe’s init.php file, plus your API credentials (you’ll need to sign up to get these https://dashboard.stripe.com/register).

Step 3

On your payment page include your config file then create a payment button as below. The price, name and email address are only used for display purposes here, and have nothing to do with how much you will actually charge the customer, which happens in the next step.

Step 4

On your callback page, to which the above form posts, take the payment. Stripe will have automatically created the stripeToken field, and populated it, in the previous step.

You must first create a customer, then charge the card.

The above will charge £1 to the card (the “amount” is in pence). In a production environment you’d want to retrieve the customer’s order details here to get the correct amount and email address.

 

This code is free to use at your own discretion. It comes without warranty. Please feel free to feedback any edits.

Discussion
Add a comment
Bayard

Thank you!
At least an easy way that works.
Stripe tutorials, and all other Youtube videos I found, didn’t work for me..

    Chris Antcliff

    You’re welcome, glad we could help 🙂

Add a comment