Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidbirkin/687d86aaf208498de7ffe29197eaac13 to your computer and use it in GitHub Desktop.
Save davidbirkin/687d86aaf208498de7ffe29197eaac13 to your computer and use it in GitHub Desktop.
private function sendWebhook( License $license )
{
$webhook = $license->webhook->url;
$payload = json_encode([
'license' => $license->key,
'expires_at' => $license->expires_at,
'customer' => $license->customer,
], JSON_THROW_ON_ERROR);
$hash = hash_hmac('sha256', $payload, $license->webhook->secret);
Http::withHeaders([
'Content-Type' => 'application/json',
'signature' => $hash
])->post($webhook, $payload);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment