stripe

Jun 29, 08:57 AM

1) install composer locally:

php -r “copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);”

php -r “if (hash_file(‘SHA384’, ‘composer-setup.php’) === ‘e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;”

php composer-setup.php ;
php -r “unlink(‘composer-setup.php’);”

2) create the composer.json file:
cat > composer.json ;

{ “require”: { “monolog/monolog”: “1.0.*” }
}

3) ?php composer.phar install;

4) create config.php, charge.php and index.php

cat > config.php ;

<?php
require_once(‘vendor/autoload.php’);

$stripe = array( “secret_key” => “sk_test_jgji8VZWf90mcw4BBaO1YiMp”, “publishable_key” => “pk_test_Dmx9iBVuUizlpXIS1DsUtYNn”
);

\Stripe\Stripe::setApiKey($stripe[‘secret_key’]);
?>

5) cat > charge.php ;

<?php require_once(’./config.php’);

$token = $_POST[‘stripeToken’]; $customer = \Stripe\Customer::create(array( ‘email’ => ‘customer@example.com’, ‘source’ => $token )); $charge = \Stripe\Charge::create(array( ‘customer’ => $customer->id, ‘amount’ => 5000, ‘currency’ => ‘usd’ )); echo ‘

Successfully charged $50.00!

‘; ?>

6) cat > index.php ;