#Gustavo-Webhooks
1 messages · Page 1 of 1 (latest)
yes
wait
<?php
require_once 'vendor/autoload.php';
header('Content-Type: application/json');
$mk = new MemberKit\Client('cg1bw8WaUh64oN9E7i9yo5Py');
$payload = file_get_contents('php://input');
$endpoint_secret = 'whsec_ABjfYAvIDT2eQ79aJDlrJF855mKsSyCE';
$sig_header = $_SERVER['HTTP_STRIPE_SIGNATURE'];
try {
$event = \Stripe\Webhook::constructEvent(
$payload, $sig_header, $endpoint_secret
);
} catch(\UnexpectedValueException $e) {
// Invalid payload
http_response_code(400);
echo $e;
exit();
} catch(\Stripe\Exception\SignatureVerificationException $e) {
// Invalid signature
http_response_code(500);
echo $e;
exit();
}
$payload = json_decode($payload);
$customer = $payload->data->object->charges->data[0]->billing_details;
$test = $mk->newUser($customer->name, $customer->email, $status='active', $blocked=false, $classroom_ids=array(78126), $unlimited=false, $membership_level_id=null, $expires_at=null);
echo json_encode(['status' => 'success']);
That works, one moment.
Also I recommend editing your message above
And removing your endpoint secret
As that is sensitive data
And this is a public server
i remove my endpoint and create new ?
evt_3L6cT0AwxDm9Wsfc065f9gkQ
last event about webhooks
I'd recommend rolling your webhook signing secret for the endpoint
Since someone could now have access to the secret you provided
Can you comment out your header('Content-Type: application/json'); from your code and retry?
Hmmm okay and I assume you updated the endpoint secret to the new secret?
yes
Let's make sure your server is getting hit at all.... can you add an error_log or an echo before the try/catch for the $payload
ok
wiat
why? C:\Users\Gustavo Santos\Downloads\stripe>stripe listen --print-secret
whsec_c63840f68d4313d9d1a9b8014b0c2bc843b4a08e95b53b13492a36fd4638eea4
cmd, why another information? this is test? having test for production ?
?
Are you using the CLI?
Doesn't look like you are to me... but if you are using stripe listen then that indicates the CLI
Which gives you its own secret
no, i'm simulate poducition.. without cli...
because, stripe cli works it
only simulate the process generate errors
error_log, dont generate log
i'm using docker, have problem ?
Yeah if you don't see the payload coming through at all then it doesn't seem to be a webhook signature issue
It sounds like the payload isn't hitting your server endpoint
only https?
wait
i'm will test now
wait pls
hey brow
i find errors
Hi 👋 I'm stepping in as my teammate needed to step away, can you share details about the errors?