Closed danieleperilli closed 1 month ago
I tested this just now and can confirm there is a bug. Interestingly, I see duplicate meta on the initial subscription order:
That meta is missing from the renewal:
8472579-zd
It looks like this could be related to the Stripe API version bump included in 8.5.0.
After making a subscription charge, we use to receive from Stripe a response that included a balance_transaction
. That balance transaction is what we used to process the fee data.
Stripe API version 2019-09-09
response includes the charge object with a balance transaction ID directly:
That's no longer the case though. In the 2024-06-20
version, the charges
arg doesn't exist, we have a latest_charge
but when you fetch the charge, the balance transaction is empty.
What I haven't yet worked out is why the balance transaction is missing when processing subscription payments, but aren't missing when you process payments on the front end. 🤔
Just following up, I've confirmed it's definitely related to the api version change. I switched out the API version used when create_and_confirm_intent_for_off_session()
is called and that resolved it.
I'd still like to look at what could be causing the difference between checkout payments and subscription payments. All I have been able to tell so far, is that Stripe updates the charge with the balance transaction after it has succeeded so there's a short delay (3ms).
The only potential fix that comes to mind is listening to that charge.updated
webhook or scheduling an async job to go update the order fee from the balance information shortly after the transaction has been processed.
I'd still like to look at what could be causing the difference between checkout payments and subscription payments.
I think I found what the difference is and what will fix it. Subscription payments don't have the capture_method
set to automatic
. I'll submit a PR later tonight.
FWIW this is the relevant change to the API:
Ref: https://docs.stripe.com/upgrades#2024-04-10
In the 2024-04-10
version they changed the default payment intent capture_method
to async so we don't get charge information immediately. As I mentioned above changing it to automatic will cause the payment to be captured as soon as it is raised and we will receive charge information.
It's not just with subscription payments. No orders since updating to 8.5.1 have included the Stripe fees in the admin order details, and I'm seeing this consistently across several sites on different servers.
Some of my clients use this fee information in their accounting, so it's important.
Describe the bug After upgrading to version 8.5.1, the Stripe fee and Stripe net are no longer saved in the orders meta. This happens only with subscriptions renewals (using WooSubscriptions), not regular orders. Our custom plugins use that information to integrate and create Journal Entries on QuickBooks, so this is very important for us.
Please refer to the same issue reported here: https://wordpress.org/support/topic/no-longer-shows-stripe-fee-and-payout/