Stripe Payment gateway integration in PHP with DEMO Examples

Stripe payment gateway integration

Stripe payment gateway integration

Stripe payment gateway offers 2 ways of integration in PHP –

  • Stripe checkout integration
  • Stripe custom integration (Stripe.js)

Strip checkout integration:

The easiest way to integrate Stripe is via Checkout, an embedded tool that takes care of building an HTML form, validating user input, and securing your customers’ card data. Using Checkout, sensitive credit card information is sent directly to Stripe, and does not touch your server. Stripe returns to your site a token representation of the card, and this token can then be used in a charge request.

Embedding Checkout in your site

To get started, add the following code to your payment page:

Stripe Checkout Demo

Reference link :

Stripe custom integration (Stripe.js):

For a more custom approach, you can instead use Stripe with your own payment form via Stripe.js.

Processing payments with Custom Stripe integration has two components:

Below code example show you demonstrate you the custom stripe integration with stripe.js.

Demo Link

You can download all above demos from below link :
Download Source Code


Browse source code in github :

If you have any additional questions Or queries, don’t hesitate to let me know!, Just put comment below or contact @ my mail id

Hope you enjoy my post 🙂



    Hi Sagar,
    Thank you very much for all details. Please confirm the PHP version required to run this and how can I auto-submit the form without manually click.

    1. Sagar Deshmukh *

      Hello Debashish,

      Stripe integration is tested for PHP 5.2, 5.3 and 5.4 and for this version it works perfect.
      Regarding form auto submit you need to use Javascript/Jquery for same.

    1. Sagar Deshmukh *


      You can add application fee as per below –

      < ?php ..... $charge = Stripe_Charge::create(array( "amount" => $amount_cents,
      “currency” => “usd”,
      “source” => $_POST[‘stripeToken’],
      “application_fee” => ““, // eg “application_fee” => 100,
      “destination” => ““, // The application fee is transafer to this stripe account
      “description” => $description)


      For reference check :

      Feel free to contact back, in case of any query.

Leave a Reply

Your email address will not be published. Required fields are marked *