Saturday, January 13 2018

Stripe Payment Gateway Integration in PHP Source Code

After long time back, we have posted an article for how to integrate stripe payment gateway in PHP source code.

It also a one of the payment gateway as like Paypal but its very easy to setup in our application.

See our demo video on Youtube:

Stripe Integration Steps:

Step 1:

First thing, we have to create an account on


Step 2:

Then login into your account.

Step 3:

Get a API key from your account.


Step 4:

Integrate for checkout from stripe documentation

Install stripe vendor files via composer to using below command.

composer require stripe/stripe-php

Create index.php paste below code in that file.

<form action="/your-server-side-code" method="POST">
    src="" class="stripe-button"

Step 5:

Create charge.php for server side code implementation

// Set your secret key: remember to change this to your live secret key in production
// See your keys here:

// Token is created using Checkout or Elements!
// Get the payment token ID submitted by the form:
$token = $_POST['stripeToken'];

// Charge the user's card:
$charge = \Stripe\Charge::create(array(
  "amount" => 1000,
  "currency" => "usd",
  "description" => "Example charge",
  "source" => $token,

Step 6:


Note that the above requests expect to receive the token ID (e.g., tok_KPte7942xySKBKyrBu11yEpf) for the value of the token parameter.

Click here to download files from github.

Thanks for reading this article.

If you are like this post and please share this post and comment your thoughts in the box.




Share Your Thoughts


I’m Blogger and Programming Blog, Tutorials, PHP, MySQL, jQuery, Laravel, Wordpress and Codeigniter