stripe checkout one time payment code example

Example: how to fill customer email stripe checkout

$session = \Stripe\Checkout\Session::create([ 
 'payment_method_types' => ['card'], 
 'line_items' => [[ 
  'price_data' => [ 
   'product_data' => [ 
    'name' => $productName, 
    'metadata' => [ 
     'pro_id' => $productID 
    ] 
   ], 
   'unit_amount' => $stripeAmount, 
   'currency' => $currency, 
  ], 
  'quantity' => 1, 
  'description' => $productName, 
 ]], 
 'mode' => 'payment', 
 'success_url' => STRIPE_SUCCESS_URL.'?session_id={CHECKOUT_SESSION_ID}', 
 'cancel_url' => STRIPE_CANCEL_URL,
 'customer_email' => '[email protected]'
]);


#https://www.fiverr.com/tamerjarrar

Tags:

Php Example