Using stripe for payment

1)To start… set up an account at https://stripe.com/gb, this is comletely free.
2)Once you’ve done this.. download the Stripe library from here https://stripe.com/docs/libraries
3)Go to your account and then account settings,then api keys…copy the one saying “API Keys” and use as key in code below.
4)

require_once('lib/Stripe.php');
Stripe::setApiKey("sk_test_your_key_here");
isset($_POST)) {
$payment = Stripe_Charge::create(array(
          'amount'        => $_POST['amount'],
          'currency'      => $_POST['currency'],
          'card'          => array(
          'number'    => $_POST['card'],
          'exp_month' => $_POST['expMonth'],
          'exp_year'  => $_POST['expYear'],
          'cvc'       => $_POST['cvc']
            ),
          'description'   => $_POST['description']
         )
);
print_r($payment);
}
 

5)Use the test card credentials
for example
currency = USD
card = 4242424242424242
expiry month = 06
expiry year = 2018
cvc = 564
The original tutorial is located at http://michaelbudd.org/tutorials/view/7/stripe-payment-gateway-tutorial-php
Thanks to Michael Budd

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s