#NormanLove

1 messages Β· Page 1 of 1 (latest)

lone whaleBOT
lost surge
#

Can you share your Stripe account ID or the event ID of a recently-undelivered event?

viscid glade
#

I can understand if I had webhooks failing on production, that would make sense

#

One moment

#

will my email work?

#

dont know where to find any other account id

#

here is first part of the email: We’re still having trouble sending requests in test mode to a webhook endpoint associated with your ProducersWork.com account. Stripe sends webhook events to your server to notify you of activity in your Stripe account, such as a completed payout or a newly-created invoice.

The URL of the failing webhook endpoint is: https://Producerswork.com/webhook.php

lost surge
#

no, email won't help in this case. you can find your account ID by logging into the Stripe Dashboard, navigating to https://dashboard.stripe.com/settings/user, and scrolling to the bottom of the page. the ID likely starts with acct_...

lone whaleBOT
viscid glade
#

acct_0KA0BB6wVCS7vFxa5xD4

molten halo
#

Hi @viscid glade I'm taking over

viscid glade
#

Nice to met you taking over

molten halo
#

Based on the log, your endpoint responds with 421 and that's whey the webhook delivery is not successful.

#

To acknowledge a successful delivery, Stripe expects your webhook endpoint to respond with 200

viscid glade
#

im not sure why that link is showing im in test mode. I just checked it and i was not in test mode. my site is live and in production mode for months now. can a site/account be in both test and not test mode????

#

when I went to my account just prior it was not in test mode

#

maybe an account created as a trial or something just finally cancelled or something, is that what happened?

#

90 day test mode trial cancells and it does not see the test authorization info or something? πŸ™‚ I dunno how to even phrase things

#

here is the code that would give a 421, directly from my webhook

#

// Include Stripe PHP library
require_once 'stripe/stripe-php/init.php';

// This is your Stripe CLI webhook secret for testing your endpoint locally.
$endpoint_secret = STRIPE_WEBHOOK_SECRET;
// $endpoint_secret = STRIPE_WEBHOOK_SECRET;
$payload = @file_get_contents('php://input');
$sig_header = $_SERVER['HTTP_STRIPE_SIGNATURE'];
$event = null;

error_log("leg 2");
try {
$event = \Stripe\Webhook::constructEvent(
$payload, $sig_header, $endpoint_secret
);
} catch(\UnexpectedValueException $e) {
// Invalid payload
http_response_code(405);
exit();
} catch(\Stripe\Exception\SignatureVerificationException $e) {
// Invalid signature
error_log(print_r('leg 3: stripe exception area SignatureVerificationException, in webhook.php', TRUE));
http_response_code(421); //422 Unprocessable Entity: The request was well-formed but was unable to be followed due to semantic errors.
exit();
}

molten halo
#

I also noticed that you are using the same endpoint for both live and test mode.

#

And your live webhook endpoint is receiving the webhooks successfully.

#

OK. My guess is that you've configured the live mode webhook secret in your webhook endpoint, and that's why the endpoint is able to construct the event in live mode but fail in test mode.

viscid glade
#

yeah 42 deals with authentication error, which a test should give since those keys are not in production

#

421

#

The real question is why is there a test mode anything firying? Im live in production and am not doing any testing . I havent been in test mode in months

#

is it from bots accessing the webhook.php file?

#

no, now that I think of it, the webhooks initiate from Stripe so it cant be bots.

molten halo
#

Let me check you test subscription.

#

For any test mode subscription that was created at least 90 days ago, Stripe will automatically cancel the subscription.

viscid glade
#

So you believe thats what we are seeing?

molten halo
#

Yes you a right. This test subscription was created 90 days ago , and that's why Stripe automatically canceled it.

viscid glade
#

at least the mystery is solved πŸ™‚ Now, is there a way to disable this so it doesnt happen in the future? Or is the answer just to delete all the test subscriptions prior to going live ☺

#

😊

molten halo
#

My advise is to avoid using the same webhook endpoint for both live and test mode.

#

So that you can configure different webhook secret in these two webhook endpoints respectively and avoid failed delivery.

viscid glade
#

but if I delete the the test endpoint wont it give a similiar error?

#

that would mean leaving the test webhook live as long as site is live

#

I guess it doesnt hurt anything to have a test webhook live forever, its just test

#

Ok, another unrelated question

#

I have the production site set to subscribe , with no trial, but business is slow so I wanted to just add a 30 day trial to the same product. that should just be something I can adjust on the Stripe dashboard right and no need to change subscription code or anything right?

molten halo
#

No it won't err if you delete the test endpoint.

#

How does your customer subscribe? Is it through Stripe checkout?

viscid glade
#

no site uses API to subscribe user to the product

#

it also processes payment via API

#

Stripe payment form I believe

molten halo
viscid glade
#

So its not just as simple as adding via the stripe dashboart a 30 day trial, and the same code will work?

molten halo
#

You can also create a subscription through Dashboard where you can specify a trial.

viscid glade
#

thats what I thought. ok thats it for me. thank you and take the rest of the day off. Thats an order πŸ™‚