Skip to content

Commit

Permalink
Fixed #259 and #289
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeholder committed Mar 8, 2024
1 parent bb99696 commit 534c25d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for Stripe for Craft Commerce

## Unreleased

- Fixed a bug where redirects could break when adding a new payment source. ([#259](https://github.com/craftcms/commerce-stripe/issues/259), [#289](https://github.com/craftcms/commerce-stripe/issues/289))

## 4.1.1 - 2024-01-12

- Fixed a bug where legacy default payment methods were not being set as default. ([#280](https://github.com/craftcms/commerce-stripe/pull/280))
Expand Down
6 changes: 5 additions & 1 deletion src/web/assets/elementsform/js/paymentForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,15 @@ class PaymentIntentsElements {
)
.join('&');

const baseUrl = this.container.dataset.confirmSetupIntentUrl;
const hasQueryString = baseUrl.includes('?');
const returnUrl = `${baseUrl}${hasQueryString ? '&' : '?'}${params}`;

this.stripeInstance
.confirmSetup({
elements,
confirmParams: {
return_url: `${this.container.dataset.confirmSetupIntentUrl}&${params}`,
return_url: `${returnUrl}`,
},
})
.then((result) => {
Expand Down

0 comments on commit 534c25d

Please sign in to comment.