Advertisement
Daniel3996

checkout.php

Nov 20th, 2023 (edited)
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. require __DIR__."/vendor/autoload.php";
  5.  
  6. $sk = "some_key";
  7.  
  8. \Stripe\Stripe::setApiKey($sk);
  9.  
  10. $ckout = Stripe\Checkout\Session::create([
  11. "mode" => "payment",
  12. "success_url" => "http://localhost/success.php",
  13. "line_items"=>[
  14. [
  15. "quantity"=>1,
  16. "price_data"=>[
  17. "currency"=>"usd",
  18. "unit_amount" => 2000,
  19. "product_data" => [
  20. "name" => "T-shirt"
  21. ]
  22. ]
  23. ]
  24. ]
  25. ]);
  26. http_response_code(303);
  27. header("Location:" .$ckout->url);
  28.  
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement