# {URL-Customer-Webhook}

***

### Description:

This endpoint is designed to communicate with alfred ecosystem to receive invoices for any "Pay Out" transactions.&#x20;

**Mode:**

`POST`

#### Node:

```bash
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:<br>

*Algorithm*:\
\
`const crypto = require('crypto');`\
`function encryptData(data) {`\
&#x20;`const dataBuffer = Buffer.from(data, "utf8");`\
&#x20;`const secretKeyBytes = Buffer.from("secret", "base64");`\
&#x20;`const hmac = crypto.createHmac("sha256", secretKeyBytes);`\
&#x20;`hmac.update(dataBuffer);`\
&#x20;`const encryptedData = hmac.digest("base64");`\
&#x20;`return encryptedData;`\
&#x20;`}` \
`const dataToEncrypt = "2023-09-25 13:48:20.890-0400d9b3146b-24e0-447089621b56125086bb";` \
`const encryptedData = encryptData(dataToEncrypt);` \
`console.log(encryptedData);`
