Jump to content

Stripe payment form help


oxhey

Recommended Posts

Iv got the stripe checkout button working with its own static fields.

 

Iv got a form which I want to pass the name , email and amount data to the stripe charge page.

 

the amount is calculated and stored in this variable : grand_total

 

here is the code for the charge page :

<?php require_once(dirname(__FILE__) . '/config.php');
 
$token  = $_POST['stripeToken'];
 
$customer = Stripe_Customer::create(array(
      "email" => 'email',
      "card"  => $token,
));
 
$charge = Stripe_Charge::create(array(
      'customer' => $customer->id,
      'amount'   => 2499,
      'currency' => 'usd'
));
 
echo '<h1>Successfully charged $24.99!</h1><br/>';
 
$_SESSION['stripeToken'] = $token;
?>

Here is the code for the form fields : 

<div class="formfield"><label for="Name" class="formlabel">Name</label><input type="text" name="Name" id="Name" size="50" /></div>

<div class="formfield"><label for="Email_Address" class="formlabel">Email</label><input type="text" name="Email_Address" id="Email_Address" size="50" /></div>

Thanks for the help

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.