Use Stripe for your credit card payments on your website
This script was designed for developers to save you valuable time when developing a website to integrate Stripe Payments on your website.
The script contains a documenting and easy-to-use class with a sample use and a tutorial for configuration from a Stripe Account.
In some lines integrate the Payment Stripe to your website.
Some example of use
Set up a Stripe Payment button :
<?php
include "class.stripe.php";
$class_stripe = new StripePaiement();
$class_stripe->setApiSecretKey("CLE_SECRET_API");
$class_stripe->setApiPublisherKey("CLE_PUBLISHABLE_API");
// Afficher le bouton de paiement Stripe
echo $class_stripe->showButtonPaiement('2,99','Le super produit','','fr','Payer par carte bancaire','eur',$array);
?>
Recover the payment :
$array = $class_stripe->getReturnPaiement('2,99','eur','Le super produit');
if(count($array) != 0)
{
if($array['validate'])
{
echo 'Paiement accepter';
print_r($array);
exit;
}
else
{
echo 'Paiement error : '.$array['msg_error'];
}
exit;
}
Refund a transaction with the transaction id
<?php
include "class.stripe.php";
$class_stripe = new StripePaiement();
$class_stripe->setApiSecretKey("CLE_SECRET_API");
$class_stripe->setApiPublisherKey("CLE_PUBLISHABLE_API");
$array = $class_stripe->refundTransaction("ID_DE_LA_TRANSACTION_A_REMBOURSER");
print_r($array);
?>
Get the current balance from the Stripe account (Payment available and pending)
<?php
include "class.stripe.php";
$class_stripe = new StripePaiement();
$class_stripe->setApiSecretKey("CLE_SECRET_API");
$class_stripe->setApiPublisherKey("CLE_PUBLISHABLE_API");
$array = $class_stripe->getBalanceStripe();
print_r($array);
?>