daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Dec 30th, 2016 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. buynow page
  2. -------------
  3.  
  4. <form action="annualForm-submit.php" method="POST">
  5.   <script
  6.     src="https://checkout.stripe.com/checkout.js" class="stripe-button"
  7.     data-key="pk_live_key"
  8.     data-amount="50"
  9.     data-name="removed"
  10.     data-description="1 Ticket"
  11.     data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
  12.     data-locale="auto"
  13.     data-zip-code="true">
  14.   </script>
  15. </form>
  16.  
  17.  
  18. annualForm-submit.php
  19. ----------------------
  20.  
  21. <?php require_once('config.php'); ?>
  22. <?php
  23.  
  24. // Get the credit card details submitted by the form
  25. $token = $_POST['stripeToken'];
  26.  
  27. // Create a charge: this will charge the user's card
  28. try {
  29.   $charge = \Stripe\Charge::create(array(
  30.     "amount" => 50, // Amount in cents
  31.     "currency" => "usd",
  32.     "source" => $token,
  33.     "description" => "Example charge"
  34.     ));
  35. } catch(\Stripe\Error\Card $e) {
  36.   // The card has been declined
  37. }
  38.  
  39.  
  40. ?>
  41. <meta http-equiv="refresh" content="0; url=annualForm-thanks.php" />
  42.  
  43. annualForm-thanks.php
  44. -----------------------
  45.  
  46. just a thank you page
  47.  
  48.  
  49. config.php
  50. --------------
  51.  
  52. <?php
  53. require_once('stripe-php-3.1.0/init.php');
  54.  
  55. $stripe = array(
  56.   "secret_key"      => "sk_live_secret",
  57.   "publishable_key" => "pk_live_secret"
  58. );
  59.  
  60. \Stripe\Stripe::setApiKey($stripe['secret_key']);
  61. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top