#ajay-webhook
1 messages · Page 1 of 1 (latest)
@weak badge hi! can you elaborate a little and give some examples or error messages you see?
I am using this code
https://dashboard.stripe.com/test/webhooks/create?endpoint_location=hosted
Created url
Also my project added that route and code
ok. So what happens when an event is sent?
here after hit this button get logs in my app
but I am trying from php code like
$customerUpdate = $stripe->customers->update(
'cus_xxxxxx',
[
'email' => 'test@gmail.com',
'description' => 'test',
]
);
dd($customerUpdate);
here dd response is getting but that webhook event not fire in stripe dashboard
I see
maybe you created the endpoint in test mode and you're updating a live mode customer?
or the customer you're updating is on an entirely different Stripe account
that is where I would start looking.
No i am testing from test mode only
does webhook automatically called if any event occurs? like customer created, subscription success
Is it working same for both test and live mode?
does webhook automatically called if any event occurs?
yep ,if an event of the type you're listening to happens, then it gets called.
not sure what "working same" means. You can create the endpoint in test mode or live mode, and it only receives events that happen in those modes, they work separately but in the same type of way.
I have tested create stripe session and redirect to stripe for subscribe
There also I get event response of customer updated and customer subscription created
only working if redirect to stripe
But from php code it wont
maybe the customer you're updating is on an entirely different Stripe account?
it would help if you can share more info like the exact cus_xxx object ID that you updated
cus_KWPF9hFWExb0VB
here is customer id
looks to me like we sent you an event? https://dashboard.stripe.com/test/events/evt_1Jrge0BXPc1EmRGH20IKEyMO
this is from stripe dashboard test event
and not from php code I write
$customerUpdate = $stripe->customers->update(
'cus_KWPF9hFWExb0VB',
[
'email' => 'test@gmail.com',
'description' => 'test',
]
);
or that webhook event fired when I subscribe to package
I have redirect to stripe or subscription
And back to my website
There I can see webhook fired
But if I use stripe js it wont
I have no idea what that means, sorry.
ok
Event fires but cant get webhook response
what does 'get webhook response' mean?
how your webhook works?
I know its post method
But I need call that webhook from my code? or stripe automatically call on all events?
it's a POST request Stripe sends to your URL.
we send that request when something happens on your account that you configured that you want to be notified about(like a customer.updated event happening), as happened in the example I showed you above.
yes I got it
but I havent received in webhook about that event is my concern
here is my code
// Handle the event
switch ($event->type) {
case 'customer.updated':
$customer = $event->data->object;
logger()->info('customer.updated');
logger()->info($customer);
break;
case 'customer.subscription.created':
$customer = $event->data->object;
logger()->info('customer.subscription.created');
logger()->info($customer);
break;
default:
logger()->info('Received unknown event type ' . $event->type);
}
we sent you the event, as you can see linked above