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

Don't process payment intent success webhooks for WCPay subscriptions related intents #3199

Merged
merged 4 commits into from
Oct 25, 2021

Conversation

james-allan
Copy link
Contributor

Fixes #3198

Changes proposed in this Pull Request

This PR fixes a bug introduced in #3118 whereby a payment intent is received without metadata containing the order ID.

It also fixes a compatibility issue with WCPay subscriptions where WC Payments would try to locate an order linked to a payment intent, but because the intent was created on Stripe's end, not via the checkout, the intent doesn't metadata including the order ID.

WC Payments handles payment intent webhooks differently (via the invoice.paid event) and so doesn't need to be handled by this function.

Requirements:

  • WC Pay Subscription billing clocks via the WCPay Dev tools plugin.
  • WC Pay Subscriptions enabled.
  • Webhook listening enabled.
    • WC Pay Server npm run listen

To test:

  1. Purchase a subscription product using WC Payments.
  2. Go to the edit subscription screen.
  3. Enable Dev Testing Mode on the right-hand side of the screen.
  4. Process the invoice upcoming, invoice created, and invoice paid events.
  5. You should get the error mentioned above.

  • Added changelog entry (or does not apply)
  • Covered with tests (or have a good reason not to test in description ☝️)
  • Tested on mobile (or does not apply)

Post merge

@james-allan james-allan added pr: needs review component: wcpay subscriptions Issues related to Stripe Billing Subscriptions labels Oct 25, 2021
@james-allan james-allan requested a review from a team October 25, 2021 05:42
@mattallan mattallan self-assigned this Oct 25, 2021
@mattallan
Copy link
Contributor

LGTM 👍

I tested subscription renewal orders and regular orders 💯

Copy link
Contributor

@mattallan mattallan left a comment

Choose a reason for hiding this comment

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

I made a small change to update where we get the $invoice_id to get it from $event_body['data']['object']

This is ready to merge

@james-allan james-allan merged commit 89766ab into develop Oct 25, 2021
@james-allan james-allan deleted the fix/issue-3198 branch October 25, 2021 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: wcpay subscriptions Issues related to Stripe Billing Subscriptions pr: needs review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

php notice processing a WC Pay Subscription renewal payment intent webhook
2 participants