Image

What is Stripe Payment Gateway?

The Stripe payment gateway provides an easy and powerful way to accept credit cards directly on the web application. Stripe make it easy to integrate checkout system and collect payment on the website. The Stripe API is a powerful solution to integrate checkout system in the web application to provide a smooth payment experience.Stripe is responsible for processing and keeping clients’ credit/debit card data so no information of essence would be stored on your server and you would not have to comply with all the rules that come with storing credit/debit cards.

Steps for Stripe Payment Gateway Integration on Google Cloud

Create account on https://dashboard.stripe.com/register.

After the setup, Login into Account and navigate to account settings > API Keys.

Before getting started Collect the Publishable key and Secret key to later use in the script. Referring stripe docs, stripe produces code which can be used on the website directly, the code which looks like this https://stripe.com/docs/checkout.

The simple integration uses a script tag inside your payment form to render the blue Checkout button. Upon completion of the Checkout process, Checkout submits your form to your server, passing along a stripeToken and any elements your form contains. When adding the following code to your page, make sure that the form submits to your own server-side code within the action attribute:

Now Replace the data-key in script code with your publishable key and in the PHP form replace the set API key with Secret key

require_once can be used in two ways, here i used example for composer so in php form you can find autoload.php. Alternatively you can download or know more about composer https://github.com/stripe/stripe-php/

Testing the Payment Process

To test the payment process, you need test card details. Use any of the following test card numbers, a valid future expiration date, and any random CVC number, to test Stripe payment gateway integration in PHP.

4242424242424242 Visa

4000056655665556 Visa (debit)

5555555555554444 Mastercard

5200828282828210 Mastercard (debit)

378282246310005 American Express

6011111111111117 Discover

Change the Test API keys (Publishable key and Secret key) with the Live API keys (Publishable key and Secret key) in the script once the testing is done with test data.

Receive latest marketing insights, data and inspiration

View Blogs ➞ Subscribe ➞

Start your Project Today

Get Started