{URL-Customer-Webhook}
Create a webhook to communicate with the alfred ecosystem to receive invoices
Description:
This endpoint is designed to communicate with alfred ecosystem to receive invoices for any "Pay Out" transactions.
Mode:
POST
Node:
CURL:
curl --location --globoff '{URL-Customer-Webhook}' \
--header 'Content-Type: application/json' \
--header 'User-Agent: Insomnia/2023.5.6' \
--header 'x-api-key: alfredpay.tmBXiGDA7RJnFCS9875hbjh6bjR6OKHtp' \
--data '{
"invoices": "154b2b72-1280-445d-9bbb-7002f23aff30",
"date_invoices": "2023-09-25 17:28:03-0000",
"signature_invoices": "0a0fO/VVWIvrij2CgdeVmpQVrpTp9z619kEIyJpWLK8="
}'
Considerations:
In order to confirm a signature authorizing a transaction, the signature and invoice date must be validated with the following algorithm:
Algorithm:
const crypto = require('crypto');
function encryptData(data) {
const dataBuffer = Buffer.from(data, "utf8");
const secretKeyBytes = Buffer.from("secret", "base64");
const hmac = crypto.createHmac("sha256", secretKeyBytes);
hmac.update(dataBuffer);
const encryptedData = hmac.digest("base64");
return encryptedData;
}
const dataToEncrypt = "2023-09-25 13:48:20.890-0400d9b3146b-24e0-447089621b56125086bb";
const encryptedData = encryptData(dataToEncrypt);
console.log(encryptedData);
Last updated