Skip to content

Delete stale _mollie_order_id meta on renewal order creation - #1253

Open
fjbender wants to merge 1 commit into
dev/developfrom
florian.bender/fix-stale-mollie-order-id-renewal-meta
Open

Delete stale _mollie_order_id meta on renewal order creation#1253
fjbender wants to merge 1 commit into
dev/developfrom
florian.bender/fix-stale-mollie-order-id-renewal-meta

Conversation

@fjbender

Copy link
Copy Markdown
Contributor

Summary

Fixes #1250 — a regression introduced in 8.1.8 silently blocks the "Pay for order" retry link for failed WooCommerce Subscriptions renewals whenever the subscription's initial payment went through the Orders API.

delete_renewal_meta() already strips _mollie_payment_id and _mollie_cancelled_payment_id that WooCommerce Subscriptions copies from the parent order onto a new renewal order, but it never cleared _mollie_order_id. Renewal orders always pay via MolliePayment (Payments API) and never create a Mollie Order themselves, so any _mollie_order_id present on a renewal order is always stale data inherited from the parent order.

cancelExistingMolliePaymentIfPending() (added in 8.1.8) checks _mollie_order_id before _mollie_payment_id, so it was resolving that stale, non-cancelable parent Order resource instead of the renewal's own failed SEPA Direct Debit payment — leading to a silent ['result' => 'failure'] on manual retry.

This is a one-line fix at the root cause: strip _mollie_order_id alongside the other inherited meta at renewal-order creation time, so it's never present to be misread later.

Test plan

  • Subscription with initial payment via Orders API (e.g. iDEAL) + SEPA Direct Debit renewal
  • Force a renewal payment failure, confirm the renewal order has no _mollie_order_id meta after creation
  • Use the "Pay for order" link and confirm the customer is redirected to a new Mollie payment instead of silently failing
  • Confirm initialPaymentUsedOrderAPI() behavior is unaffected (it reads the meta off the parent order, not the renewal order)

Fixes #1250. delete_renewal_meta() already strips _mollie_payment_id
and _mollie_cancelled_payment_id copied over from the parent order by
WooCommerce Subscriptions, but left _mollie_order_id behind. Renewal
orders never create a Mollie Order themselves (only MolliePayment is
used for renewals), so any _mollie_order_id present is always stale
data inherited from the parent order's initial Orders API payment.

That stale value caused cancelExistingMolliePaymentIfPending() to
check the parent's old, non-cancelable Orders API resource instead of
the renewal's own Payments API transaction, silently blocking manual
"Pay for order" retries for failed subscription renewals.
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.

Silent payment failure WooCommerce Subscriptions "Pay for order" links after upgrading 8.1.6 → 8.1.8

1 participant