#ajay-webhook

1 messages · Page 1 of 1 (latest)

wise veldt
#

@weak badge hi! can you elaborate a little and give some examples or error messages you see?

weak badge
wise veldt
#

ok. So what happens when an event is sent?

weak badge
#

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

wise veldt
#

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.

weak badge
#

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?

wise veldt
#

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.

weak badge
#

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

wise veldt
#

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

weak badge
#

cus_KWPF9hFWExb0VB
here is customer id

wise veldt
weak badge
#

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',
]
);

weak badge
#

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

wise veldt
#

I have no idea what that means, sorry.

weak badge
#

ok
Event fires but cant get webhook response

wise veldt
#

what does 'get webhook response' mean?

weak badge
#

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?

wise veldt
#

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.

weak badge
#

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);
}

wise veldt
#

we sent you the event, as you can see linked above