Advertisement
Guest User

Untitled

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