Good-Bids / goodbids

0 stars 0 forks source link

[Troubleshoot] Nonprofit Invoices on Production #922

Closed clatwell closed 5 months ago

clatwell commented 6 months ago

Hey, @bd-viget! Up until yesterday evening, the Stripe Payment Gateway connection between the GB Main Site and the GB Stripe account was still in test mode, which means Invoices that were generated by the system (in WordPress) prior to yesterday evening aren't backed by real Stripe invoices.

Last night, I turned off test mode for the Stripe Payment Gateway, and I attempted to register a Webhook in the GB Stripe account. This morning at 9AM, the Hockey Stick auction for the Million Meal Project Nonprofit closed, and a corresponding WP Invoice was generated for the auction. Because the gateway is no longer in test mode, I would have expected that a Customer + Invoice would have been created for the Auction in Stripe. However, here's what I'm seeing:

I could use your help figuring out why a Stripe Customer + Invoice were not generated when the Kaapo Kakko NYR hockey stick auction closed at 9AM this morning. Some additional notes for testing:

After we investigate this issue, I could also use your help...

linear[bot] commented 6 months ago
GOO-331 [Troubleshoot] Nonprofit Invoices on Production

Hey, @bd-viget! Up until yesterday evening, the Stripe Payment Gateway connection between the GB Main Site and the GB Stripe account was still in test mode, which means Invoices that were generated by the system (in WordPress) prior to yesterday evening aren't backed by real Stripe invoices. Last night, I turned off test mode for the Stripe Payment Gateway, and I attempted to register a Webhook in the GB Stripe account. This morning at 9AM, the [Hockey Stick auction](https://www.goodbids.org/million-meal-project/wp-admin/post.php?post=70&action=edit) for the Million Meal Project Nonprofit closed, and a corresponding [WP Invoice](https://www.goodbids.org/million-meal-project/wp-admin/post.php?post=483&action=edit) was generated for the auction. Because the gateway is no longer in test mode, I would have expected that a Customer + Invoice would have been created for the Auction in Stripe. However, here's what I'm seeing: * No Stripe Customer created for Million Meals Project * No Stripe Customer data showing for the [MMP Site in the Network Admin](https://www.goodbids.org/wp-admin/network/site-settings.php?page=goodbids-site-details&id=12) * No Customer exists for [MMP in Stripe](https://dashboard.stripe.com/customers) -- ([details here in 1P](https://viget.1password.com/vaults/maxyfxamkf65q6flnyqzyixhgi/allitems/w3gio4bzeypd6ohelp6q5cdwpm)) * No Stripe Invoice created for the Auction * When I click [Integrity Check](https://www.goodbids.org/wp-admin/network/admin.php?page=gb-invoices&action=integrity_check&invoice=12%7C483) for the Invoice, I see a $stripe_invoice_id is null error. * No [Invoices](https://dashboard.stripe.com/invoices) exist in Stripe I could use your help figuring out why a Stripe Customer + Invoice were not generated when the Kaapo Kakko NYR hockey stick auction closed at 9AM this morning. Some additional notes for testing: * On the [WooCommerce > Settings > Payments > Stripe > Settings](https://www.goodbids.org/wp-admin/admin.php?page=wc-settings&tab=checkout%C2%A7ion=stripe&panel=settings) page, I can see that Test Mode is no longer enabled (I toggled the checkbox off last night) * On the same page, I see Webhook: Enabled. * When I login to the GB stripe account ([details here in 1P](https://viget.1password.com/vaults/maxyfxamkf65q6flnyqzyixhgi/allitems/w3gio4bzeypd6ohelp6q5cdwpm)) and navigate to the [Developers > Webhooks](https://dashboard.stripe.com/webhooks) page, I see the [Webhook hosted endpoint](https://dashboard.stripe.com/webhooks/we_1P8X6aExsjWvLeibnBafdaY1) I created last night. It's set up to send these events: * invoice.sent * invoice.paid * invoice.overdue After we investigate this issue, I could also use your help... * Thinking through what we should do about all the invoices that were created in WordPress prior to today (4/23) that aren't backed by Stripe invoices... it sounds like GB may not actually want/need to invoice Nonprofits for their participation in the soft launch, but we don't want these non-functional Stripe Invoices to cause their accounts to become delinquent. We may just want to delete these from the server, but we need to coordinate with the GB team before we do that. * Confirming that I set up the Webhook endpoint properly

clatwell commented 6 months ago

Heads up, this Octopus Doodle Edition auction for the buildOn site is scheduled to close in 22 minutes. I'll keep an eye on this one too; my suspicion is that a Stripe Customer and Invoice won't be created when this Auction closes, but that would be another data point we can look at.

clatwell commented 6 months ago

Actually @bd-viget I think I may have figured this out. I noticed a mismatch between the live publishable + secret API keys in the GB Stripe Account vs. what we had in WordPress. I got those updated. Let's wait for the Octopus Doodle auction to close before we move forward with testing on this; that one may work now that the API keys have been updated!

clatwell commented 6 months ago

@bd-viget - I did some more digging here but don't have much additional to report:

There are just two more live auctions running on production for the soft launch; one is scheduled to end in 10 hours, the other in 23 hours. If we want to get any logging up on production, we may wanna go ahead and hop on it today.

bd-viget commented 5 months ago

This is the first place I would suggest we look at to see what could be going on. We have 3 "fatal" scenarios that would cause the Stripe class not to initialize, and 1 warning for Webhooks, but doesn't affect initialization.

If this method doesn't reach line 94 where the class is marked as initialized, creating Stripe invoices dies early.

I have a draft PR up here with some tools that will help with invoices going forward. I'm going to try to dig through the logs on Production to see if I can find anything related to Stripe.