Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.59 KB | None | 0 0
  1. <?php
  2.  
  3. function calculateOrderAmount() {
  4.     // Replace this constant with a calculation of the order's amount
  5.     // Calculate the order total on the server to prevent
  6.     // people from directly manipulating the amount on the client
  7.     return 100;
  8. }
  9. $
  10. /*$customer = \Stripe\Customer::create(array(
  11.     "name" => 'Palash Sarkar',
  12.     "description" => 'FosterBiz Services Item 001',
  13.     "email" => 'ranbirit.palash@gmail.com',
  14.     "phone" => '9998404540',
  15.     "address" => ["city" => 'Ahmedabad', "country" => 'IN', "line1" => '89 Amit park Isanpur', "line2" => 'Opp Vishalnagar', "postal_code" => '382443', "state" => 'Gujarat']
  16. ));*/
  17. $orderID = "orderId";
  18.  
  19. $paymentMethod = \Stripe\PaymentMethod::create([
  20.       "billing_details" => [
  21.         "address" => [
  22.           "city" => "Ahmedabad",
  23.           "country" => "IN",
  24.           "line1" => "89 Amit park Isanpur",
  25.           "line2" => "Opp Vishalnagar",
  26.           "postal_code" => "382443",
  27.           "state" => "Gujarat"
  28.         ],
  29.         "email" => "ranbirit.palash@gmail.com",
  30.         "name" => "Palash Sarkar",
  31.         "phone" => "9998404540"
  32.         ],
  33.    'type' => 'card',
  34.   'card' => [
  35.     'number' => '4242424242424242',
  36.     'exp_month' => 2,
  37.     'exp_year' => 2021,
  38.     'cvc' => '314',
  39.   ],
  40. ]);
  41.  
  42. $paymentIntent = \Stripe\PaymentIntent::create([
  43.     'amount' => calculateOrderAmount(),
  44.     'currency' => "eur",
  45.     'customer' => "cus_GlQo0OBAUtF0o5",
  46.     'description' => "FosterBiz Online Services",
  47.     'payment_method' => $paymentMethod->id,
  48.     'metadata' => array(
  49.       'order_id' => $orderID
  50.     )
  51.     ]);
  52. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement