Commit 9d77555
committed
fix(payments-next): Coupon updates cause Stripe Element state loss
Because:
* Updating a coupon would cause rerenders of the stripe PaymentElement in the case of the PaymentElement representing an existing payment method with expired card data
* We create a new client session each time a cart is fetched, and when we apply a coupon, the route is revalidated. This causes the cart to be refetched.
* The front end passes this updated client session secret key to the Elements wrapper, which triggers a refresh of the PaymentElement
this commit:
* Adds in an explicit key to ensure that changing carts in-browser always changes the stripe session
* Preserves the initial client session secret key on the front end for use in the Stripe Elements component, preventing unnecessary rerenders
* Uses a minimally-invasive approach to resolving this issue, as the issue could not be replicated locally. Stripe tooling around expired cards is not working as intended.
Closes #PAY-31571 parent 898f8cc commit 9d77555
1 file changed
Lines changed: 8 additions & 2 deletions
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| |||
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
136 | 142 | | |
137 | 143 | | |
138 | 144 | | |
| |||
144 | 150 | | |
145 | 151 | | |
146 | 152 | | |
147 | | - | |
| 153 | + | |
148 | 154 | | |
149 | 155 | | |
150 | 156 | | |
| |||
158 | 164 | | |
159 | 165 | | |
160 | 166 | | |
161 | | - | |
| 167 | + | |
162 | 168 | | |
163 | 169 | | |
164 | 170 | | |
| |||
0 commit comments