Stripe Payment Gateway Integration on Google Cloud

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.

Let’s start integration:

Step 1: Create account on

Step 2: 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

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:

Step 3: Now Lets see how to create a PHP form which communicate with the stripe script code

Step 4: 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

Step:5 : 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

Thank you !! Visit us again

Looking for a Top Rated* Marketing Company?

Contact us at +1 630 999 SPOT (7768) or submit a business inquiry online.