Skip to content

[MKT-1057]Fix/failed payment in klarna and paypal send purchase done event - #2196

Merged
internxt-yu merged 5 commits into
fix/google-tracking-problemfrom
fix/failed-payment-in-Klarna-and-paypal-send-purchase-done-event
Oct 5, 2026
Merged

internxt-yu merged 5 commits into
fix/google-tracking-problemfrom
fix/failed-payment-in-Klarna-and-paypal-send-purchase-done-event

Conversation

@internxt-yu

@internxt-yu internxt-yu commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

We noticed that in Google Analytics shows purchases that not exists in Stripe done transactions and after investigation we saw that were failed purchase actions paying by Klarna or Paypal, which leave our checkout page to complete the purchase. After this, when the user returns, it redirected to checkoutSuccessfulView, whether the payment is done correctly or is failed, the purchase event is sent.
The change is basically adding a conditional check if the payment is successful or not, to see if the purchase event has to be sent to tracking sites or not.
The solution was in checkoutSuccessVIew add a method that check in the return URL of Stipe the status of payment. (SetupIntent when Stripe store the payment method to future payment; PaymentIntent when the payment is done directly, if the Intent was requested with wrong method, it return error).
We send the purchase tracking event is the purchase was successful with the return status of succeeded and ignore for the rest of status.

Related Issues

Related Pull Requests

Checklist

  • Changes have been tested locally.
  • Unit tests have been written or updated as necessary.
  • The code adheres to the repository's coding standards.
  • Relevant documentation has been added or updated.
  • No new warnings or errors have been introduced.
  • SonarCloud issues have been reviewed and addressed.
  • QA Passed

Testing Process

The testing process was in the checkout page do a test payment:

  1. If the purchase was successful, the tracking event wil be sent and if we filter by collect we see the purchase event sent to Google Analytics.
  2. It the payment fails, no purchase event is sent.
    Screencast from 2026-10-01 09-02-17.webm

Additional Notes

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Deploying drive-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: 19045b8
Status: ✅  Deploy successful!
Preview URL: https://f5b5f910.drive-web.pages.dev
Branch Preview URL: https://fix-failed-payment-in-klarna.drive-web.pages.dev

View logs

@internxt-yu
internxt-yu changed the base branch from master to fix/google-tracking-problem September 30, 2026 16:03
@internxt-yu
internxt-yu added this pull request to stack #2197 September 30, 2026 16:04
@sonarqubecloud

Copy link
Copy Markdown

@internxt-yu internxt-yu self-assigned this Sep 30, 2026
@internxt-yu internxt-yu added the bug Something isn't working label Sep 30, 2026
@internxt-yu
internxt-yu marked this pull request as ready for review October 1, 2026 07:36
@internxt-yu
internxt-yu marked this pull request as draft October 1, 2026 07:37
@internxt-yu
internxt-yu marked this pull request as ready for review October 1, 2026 09:09
Comment thread src/views/Checkout/views/CheckoutSuccessView.tsx Outdated
Comment thread src/views/Checkout/views/CheckoutSuccessView.tsx Outdated
Comment thread src/views/Checkout/views/CheckoutSuccessView.tsx Outdated
Comment thread src/views/Checkout/views/CheckoutSuccessView.tsx Outdated
@internxt-yu
internxt-yu force-pushed the fix/failed-payment-in-Klarna-and-paypal-send-purchase-done-event branch from e2f4a8f to 03f1b51 Compare October 1, 2026 12:55
@internxt-yu
internxt-yu requested a review from a team as a code owner October 1, 2026 12:55
@internxt-yu
internxt-yu requested review from CandelR and xabg2 October 1, 2026 13:45
@internxt-yu
internxt-yu force-pushed the fix/failed-payment-in-Klarna-and-paypal-send-purchase-done-event branch from 0138820 to 943ccea Compare October 2, 2026 09:50
@internxt-yu
internxt-yu force-pushed the fix/failed-payment-in-Klarna-and-paypal-send-purchase-done-event branch from 943ccea to 40591c6 Compare October 2, 2026 09:52
Comment thread src/views/Checkout/views/CheckoutSuccessView.tsx Outdated
@internxt-yu
internxt-yu requested a review from CandelR October 2, 2026 12:12

@CandelR CandelR left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready for QA @internxt-yu

@internxt-yu
internxt-yu force-pushed the fix/failed-payment-in-Klarna-and-paypal-send-purchase-done-event branch from 7868e5a to 19045b8 Compare October 5, 2026 07:04
@sonarqubecloud

sonarqubecloud Bot commented Oct 5, 2026

Copy link
Copy Markdown

@internxt-yu
internxt-yu merged commit cd7c2d4 into master Oct 5, 2026
11 checks passed
@internxt-yu
internxt-yu deleted the fix/failed-payment-in-Klarna-and-paypal-send-purchase-done-event branch October 5, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants