Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use custom order IDs in create intent request #3398

Merged
merged 4 commits into from
Sep 4, 2024

Conversation

Mayisha
Copy link
Contributor

@Mayisha Mayisha commented Aug 30, 2024

Fixes #3397

Custom order IDs are ignored in the create intent request when the new checkout experience is enabled.
This error does not happen in the legacy checkout experience because in the legacy experience get_order_number method is used in the metadata ( which is hooked to the woocommerce_order_number filter).

Changes proposed in this Pull Request:

In this PR, we are using the get_order_number instead of get_id for in the metadata of create intent request.

Testing instructions

  1. Install any plugin for custom order IDs (e.g Custom Order Numbers for WooCommerce which is used by the reporter)
  2. Update the plugin's settings installed in the previous step to use custom order IDs. ( I have used #Test - prefix in my test below)
  3. In your Stripe settings page enable the new checkout experience.
  4. Enabled logs for the Stripe plugin.
  5. Now as a shopper, add a product to your card and complete the checkout with a credit card.
  6. Go to WooCommerce > Status > Logs and open the log file which includes the recent order logs.
  7. Find the log for payment_intents request.
  8. In develop notice the metadata field. Notice that it is sending the actual database order ID instead of the custom pre-fixed order ID.
Screenshot 2024-08-30 at 4 44 04 PM
  1. Now checkout to this branch and as a shopper purchase a product again.
  2. Find the log for payment_intents request for this order.
  3. Notice that now it is sending the custom pre-fixed order ID in the meta data.
Screenshot 2024-08-30 at 4 45 34 PM

@Mayisha Mayisha requested a review from wjrosa August 30, 2024 11:08
@Mayisha Mayisha force-pushed the fix/custom-order-number branch from 71f2850 to 486638c Compare August 30, 2024 12:26
Copy link
Contributor

@wjrosa wjrosa left a comment

Choose a reason for hiding this comment

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

Nice fix! Code is good and works as expected:
Screenshot 2024-09-03 at 11 17 57

@Mayisha Mayisha merged commit eb0810c into develop Sep 4, 2024
34 of 35 checks passed
@Mayisha Mayisha deleted the fix/custom-order-number branch September 4, 2024 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom order IDs are not used when creating intent
2 participants