Receiving and understanding messages
Request
Sample header
Accept: application/json
X-PURCHASELY-SIGNATURE: ea909...ba5a6,
X-PURCHASELY-TIMESTAMP: 1580...929Authenticating request and verifying signature (recommended)
const crypto = require("crypto");
// Request headers
// ---------------
const xPurchaselyTimestamp = "1580909929";
const xPurchaselySignature = "ea909b88098b63ef93711cd14542403e5efe1a23c07d94a764bd4db55abba5a6";
// Signature verification
// ----------------------
const webhookSharedSecret = "foobar";
const dataToSign = webhookSharedSecret + xPurchaselyTimestamp;
const computedSignature = crypto
.createHmac("sha256", webhookSharedSecret)
.update(dataToSign)
.digest("hex");
if (computedSignature === xPurchaselySignature) {
// request authenticated
}require 'openssl'
# Request headers
# ---------------
x_purchasely_timestamp = '1580909929'
x_purchasely_signature = 'ea909b88098b63ef93711cd14542403e5efe1a23c07d94a764bd4db55abba5a6'
# Signature verification
# ----------------------
webhook_shared_secret = 'foobar'
data_to_sign = webhook_shared_secret + x_purchasely_timestamp
computed_signature = OpenSSL::HMAC.hexdigest('sha256', webhook_shared_secret, data_to_sign)
if (computed_signature == x_purchasely_signature) {
# request authenticated
}Body
Sample body
Model
Event
Attributes
Response
Last updated