-
Notifications
You must be signed in to change notification settings - Fork 682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[15.x] Stripe API and SDK update #1615
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,11 +160,18 @@ public function createInvoice(array $options = []) | |
{ | ||
$this->assertCustomerExists(); | ||
|
||
$stripeCustomer = $this->asStripeCustomer(); | ||
|
||
$parameters = array_merge([ | ||
'automatic_tax' => $this->automaticTaxPayload(), | ||
'customer' => $this->stripe_id, | ||
'currency' => $stripeCustomer->currency ?? config('cashier.currency'), | ||
], $options); | ||
|
||
if (isset($parameters['subscription'])) { | ||
unset($parameters['currency']); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if (array_key_exists('subscription', $parameters)) { | ||
unset($parameters['pending_invoice_items_behavior']); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,6 +89,10 @@ public function createPayment($amount, array $options = []) | |
$options['customer'] = $this->stripe_id; | ||
} | ||
|
||
if ($options['confirm'] ?? false) { | ||
$options['return_url'] ??= route('home'); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When a payment intent is being confirmed, we'll always need to supply a return url. |
||
return new Payment( | ||
static::stripe()->paymentIntents->create($options) | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There cannot be multiple currencies anymore on invoices so we'll use the one from the customer or fallback to the Cashier default.