Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <?php
  2. require_once('config.php');
  3.  
  4. $token = $_POST['stripeToken'];
  5.  
  6. $stripeinfo = \Stripe\Token::retrieve($token);
  7. $email = $stripeinfo->email;
  8.  
  9. $customer = \Stripe\Customer::create(array(
  10. 'email' => $email,
  11. 'source' => $token,
  12.  
  13. ]);
  14. \Stripe\InvoiceItem::create([
  15. 'amount' => 2500,
  16. 'currency' => 'usd',
  17. 'customer' => '$customer.id',
  18. 'description' => 'Refundable Deposit',
  19. ]);
  20.  
  21. \Stripe\Subscription::create([
  22. 'customer' => '$customer.id',
  23. 'items' => [
  24. [
  25. 'plan' => 'plan_test',
  26. 'tax_percent' => 8.25,
  27. ],
  28. ]
  29. ]);
  30.  
  31. ));
  32. echo '<h1>Successfully charged $29.95!</h1>';
  33.  
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement