Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
fix: Update Payment Intent on capture-context call if existing
Browse files Browse the repository at this point in the history
  • Loading branch information
julianajlk committed May 9, 2024
1 parent 6f9cff2 commit 6c4cf43
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ecommerce/extensions/payment/processors/stripe.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,12 @@ def get_capture_context(self, request):
# This includes canceled status, since if one is create with idempotency key for an existing
# payment with canceled status, it will not create a new Payment Intent.
stripe_response = self.cancel_and_create_new_payment_intent_for_basket(basket, payment_intent_id)

else:
# Update the Payment Intent with the latest item in the cart
stripe.PaymentIntent.modify(
payment_intent_id,
**self._build_payment_intent_parameters(basket),
)
# If a Payment Intent exists in a confirmable status, it will skip the below else statement,
# aka not create another intent with the idempotency key this time around.

Expand Down

0 comments on commit 6c4cf43

Please sign in to comment.