Untitled
unknown
php
4 years ago
1.4 kB
12
Indexable
$session = $stripe->checkout->sessions->create([
'payment_method_types' => ['card'],
'tax_id_collection' => [
'enabled' => true,
],
'line_items' => [
[
'quantity' => 1,
'price_data' => [
'currency' => 'USD',
//price in cents
'unit_amount' => $price * 100,
'tax_behavior' => 'exclusive',
'product' => $product->id,
],
'dynamic_tax_rates' => $taxRates->pluck('id')->all(),
],
],
'mode' => 'payment',
'payment_intent_data' => [
'capture_method' => 'manual',
'setup_future_usage' => 'off_session',
'receipt_email' => $buyer->getEmail()
],
'customer' => $customer->id,
'customer_update' => [
'address' => 'auto',
'name' => 'auto'
],
//TODO-payment set success url
'success_url' => 'https://example.com/success',
//TODO-payment set payment url
'cancel_url' => 'https://example.com/cancel',
]);Editor is loading...