Stripe Payment gateway integration in PHP with DEMO Examples

Stripe Payment gateway integration in PHP with DEMO Examples

In this Post We Will Explain About is Stripe Payment gateway integration in PHP with DEMO Examples With Example and Demo.Welcome on – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Integrating Payments with the Stripe APIExample

In this post we will show you Best way to implement Stripe payment gateway integration in php source code, hear for How to Integrate Stripe Payment Gateway in PHPwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Stripe payment gateway There are following 2 ways of simple integration using PHP.
1.Stripe checkout integration using PHP
2.Stripe custom integration using (Stripe.js)

Also Read :   PHP Mail Attachment - Php Send Email File-Images Attachments

Integrate Stripe Payment Gateway Using PHP and JavaScript

Below source code to example learn the custom stripe integration with stripe.js as well as stripe_payment_aip_checkout_example.php.

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Live24u Stripe Pay Checkout using PHP</title>
<h1 class="bt_title" align="center">Live24u Stripe Pay Checkout using PHP</h1>
<div align="center">
  <form action="" method="POST">
    src="" class="stripe-button"
    data-key="<?php echo $liveparam['public_test_key']; ?>"


 * Source Code - Stripe - Payment Gateway integration using PHP (Stripe Checkout)
 * ==============================================================================
 * @version v8.0: stripe_payment_aip_checkout_example.php 2018/10/05
 * @copyright Copyright (c) 2018,
 * @author DSP Patel <>
 * You are very 100% free to use, simple distribute, as well as modify your Source Code
 * ==============================================================================

// simple include Stripe library
require 'stripe/Stripe.php';

$liveparam = array(
	"testmode"   => "on",
	"private_live_key" => "sk_test_a12RX6Z48Jdkl6mEag4Gd6al",
	"public_live_key"  => "pk_test_a12RX6Z48Jdkl6mEag4Gd6al",
	"private_test_key" => "sk_test_a12RX6Z48Jdkl6mEag4Gd6al",
	"public_test_key"  => "pk_test_a12RX6Z48Jdkl6mEag4Gd6al"

if ($liveparam['testmode'] == "on") {
	$pubkey = $liveparam['public_test_key'];
} else {
	$pubkey = $liveparam['public_live_key'];

	$amount_cents = str_replace(".","","600.52");  // your Chargeble amount
	$invoiceid = "14526321";                      // your Live Invoice ID
	$description = "Invoice #" . $invoiceid . " - " . $invoiceid;

	try {
		$success_payments = Stripe_Charge::create(array(		 
			  "amount" => $amount_cents,
			  "currency" => "usd",
			  "source" => $_POST['stripeToken'],
			  "description" => $description)			  

		if ($success_payments->card->address_zip_check == "fail") {
			throw new Exception("zip_check_invalid");
		} else if ($success_payments->card->address_line1_check == "fail") {
			throw new Exception("address_check_invalid");
		} else if ($success_payments->card->cvc_check == "fail") {
			throw new Exception("cvc_check_invalid");
		// PHP Payment has succeeded simple, no exceptions were any more thrown as well as otherwise caught				

		$result = "success";

	} catch(Stripe_CardError $e) {			

	$error = $e->getMessage();
		$result = "declined";

	} catch (Stripe_InvalidRequestError $e) {
		$result = "declined";		  
	} catch (Stripe_AuthenticationError $e) {
		$result = "declined";
	} catch (Stripe_ApiConnectionError $e) {
		$result = "declined";
	} catch (Stripe_Error $e) {
		$result = "declined";
	} catch (Exception $e) {

		if ($e->getMessage() == "zip_check_invalid") {
			$result = "declined";
		} else if ($e->getMessage() == "address_check_invalid") {
			$result = "declined";
		} else if ($e->getMessage() == "cvc_check_invalid") {
			$result = "declined";
		} else {
			$result = "declined";
	echo "<BR> - Stripe Payment Status : ".$result;
	echo "<BR> Stripe Response : ";
	print_r($success_payments); exit;

Browse source code in github :

Also Read :   Filtering Angularjs Items based on start and end date

I hope you have Got What is Integrate Stripe Payment Gateway Using PHP and JavaScript And how it works.I would Like to have FeadBack From My Blog( readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article( Are Most Always Welcome.