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

fix: Capture-context cancel and create Payment Intent update #4156

Merged

Conversation

julianajlk
Copy link
Contributor

@julianajlk julianajlk commented Apr 23, 2024

REV-3821.

When a card is declined, the Payment Intent is canceled. Previously we didn't address this concern, and I'd imagine it was something that was happening.
Now with the introduction of the cancel_and_create_new_payment_intent() check on /capture-context endpoint, we call this function to reset the payment, by canceling the existing Payment Intent and creating a new one.
In local testing we found that if we call Stripe to create a new PI with idempotency key, it keeps the same PI, even with canceled status. So this scenario should go through cancel_and_create_new_payment_intent() without idempotency key.

However, when we call to cancel on an existing Payment Intent with status canceled, it errors out with -
You cannot cancel this PaymentIntent because it has a status of canceled. Only a PaymentIntent with one of the following statuses may be canceled: requires_payment_method, requires_capture, requires_confirmation, requires_action, processing.

Adding a try/except to avoid this.

@julianajlk julianajlk requested a review from a team as a code owner April 23, 2024 14:58
@julianajlk julianajlk changed the base branch from master to 2u/main April 23, 2024 14:58
@julianajlk julianajlk force-pushed the julianajlk/REV-3821/capture-context-cancel-pi-update branch from 2dde6f9 to 7efa216 Compare April 23, 2024 15:46
@julianajlk julianajlk force-pushed the julianajlk/REV-3821/capture-context-cancel-pi-update branch from 7efa216 to 2adf737 Compare April 23, 2024 15:49
@julianajlk julianajlk changed the title fix: Update cancel Payment Intent on existing one fix: Capture-context cancel and create Payment Intent update Apr 23, 2024
@julianajlk julianajlk merged commit 73c6110 into 2u/main Apr 23, 2024
8 checks passed
@julianajlk julianajlk deleted the julianajlk/REV-3821/capture-context-cancel-pi-update branch April 23, 2024 16:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants