Created
March 31, 2024 14:36
-
-
Save davidbirkin/687d86aaf208498de7ffe29197eaac13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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