When PayInGame sends a webhook to your endpoint, it includes a header called:
Payingame-Signature
This header lets you verify that the webhook was sent by PayInGame, not a malicious third party.
The header looks like this:
t=1762795211,v1=d4ec6316d9dcbbc06db0a18bdf8cdb73c8865d4d5134c9890ba39a15a8f17b26
- t: Unix timestamp (in seconds) when the webhook was generated
- v1: HMAC-SHA256 signature of the payload, computed using your secret key
How It Works
When your project’s webhook is triggered, we compute:
signedPayload = “timestamp.raw_body”
Then we sign that payload using your webhook secret key (a 256-bit hex string) with HMAC-SHA256:
hmacValue = hmac(signedPayload, secretKey, “HMACSHA256”, “UTF-8”)
Example
Example webhook payload:
translates into string:
{"PaymentGuid":"9C4E0E58-ABF8-DFC3-D130-EF993228349F","ProjectGuid":"5E3E59A2-FC03-88DE-6135-C05FAE5BA7B2","Quantity":1,"Products":["7BC62A19-E33F-E99D-F582-B720FF46A8CA","7BC62A19-E33F-E99D-F582-B720FF46A8CA"],"UserID":"Cus123"}
This is the raw_body that is used later on.
Example signature header:
Example secret key:
Computed HMAC:
This results in:
Receiver side (example .net)