So I'm trying to get stripe setup on my server but I'm having a problem. I'm using checkout v2 on my page and the form works perfectly, however the token never passes through to my php file. the card is charged but the information does not show up on the dashboard, it is in the log though.
here's what I have:
<form action="assets/php/slingshot.php" method="POST">
<button id="customButton">Purchase</button>
<script>
$('#customButton').click(function(){
var token = function(res){
var $input = $('<input type=hidden name=stripeToken />').val(res.id);
$('form').append($input).submit();
};
StripeCheckout.open({
key: 'pk_live_*************************',
address: true,
amount: 2500,
currency: 'usd',
name: 'test',
description: 'A bag of test',
panelLabel: 'Checkout',
token: token
});
return false;
});
</script>
</form>
and then for slingshot.php:
<?php
require_once(dirname(__FILE__) . '/config.php');
$token = $POST['stripeToken']; //get the creditcard details from the form
try {
$charge = Stripe_Charge::create(array(
'card' => $token,
'amount' => 2500, //amount in cents
'currency' => 'usd',
'description' => 'Get Bacon Direct, LLC'
));
} catch(Stripe_CardError $e) {
// The card has been declined
}
echo '<h1>Successfully charged $25.00 </h1>';
}
?>
and my config.php file:
<?php
require_once('stripe-php/lib/Stripe.php');
// Set your secret key: remember to change this to your live secret key in production
// See your keys here https://manage.stripe.com/account
$stripe = array(
"secret_key" => "sk_live_************************************",
"publishable_key" => "pk_live_************************************"
);
Stripe::setApiKey($stripe['secret_key'] );
?>
could you please help me out?