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 : https://stripe.com/docs/checkout/tutorial

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

Or

Browse source code in github : https://github.com/sagarsdeshmukh/Stripe_gateway_integration_demo_with_PHP

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

Hope you enjoy my post 🙂

4 comments:

  1. DEBASISH MONDAL

    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 *

      Hello,

      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 :
      https://support.stripe.com/questions/how-can-i-customize-the-way-that-fees-are-applied-for-accounts-that-are-connected

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

Leave a Reply

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