@spritz-finance/api-client 0.4.7 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/spritz-api-client.cjs +22 -22
- package/dist/spritz-api-client.d.ts +4 -1
- package/dist/spritz-api-client.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -974,6 +974,10 @@ Spritz currently supports the following webhook events:
|
|
|
974
974
|
- `payment.completed`: Triggered when a payment is successfully completed.
|
|
975
975
|
- `payment.refunded`: Triggered when a payment is refunded.
|
|
976
976
|
|
|
977
|
+
#### Verification Events
|
|
978
|
+
|
|
979
|
+
- `verification.status.updated`: Triggered when a user's verification status changes.
|
|
980
|
+
|
|
977
981
|
These events allow you to respond to changes in the account and payments for a user.
|
|
978
982
|
|
|
979
983
|
### Setting up webhooks
|
|
@@ -999,3 +1003,23 @@ Upon receiving a webhook, your server will get a payload with the following stru
|
|
|
999
1003
|
"eventName": "name-of-the-event-here"
|
|
1000
1004
|
}
|
|
1001
1005
|
```
|
|
1006
|
+
|
|
1007
|
+
### Webhook security and signing
|
|
1008
|
+
|
|
1009
|
+
Each webhook request is signed using an HMAC SHA256 signature, based on the exact JSON payload sent in the body. This signature is included in the Signature HTTP header of the request.
|
|
1010
|
+
|
|
1011
|
+
The secret key used to compute the signature is the webhook secret you set when configuring your webhook integration. If you have not set a webhook secret, there will be no Signature header in the webhook request.
|
|
1012
|
+
|
|
1013
|
+
You can verify webhook authenticity by computing the HMAC signature and comparing it to the Signature header included in the webhook request.
|
|
1014
|
+
|
|
1015
|
+
#### Example: Verifying a webhook signature (Node.js)
|
|
1016
|
+
|
|
1017
|
+
```typescript
|
|
1018
|
+
import { createHmac } from "crypto";
|
|
1019
|
+
|
|
1020
|
+
const signature = createHmac("sha256", <YOUR_WEBHOOK_SECRET>)
|
|
1021
|
+
.update(<REQUEST_BODY_AS_JSON_STRING>) // JSON.stringify(payload)
|
|
1022
|
+
.digest("hex");
|
|
1023
|
+
```
|
|
1024
|
+
|
|
1025
|
+
Ensure that the computed signature matches the Signature header received in the webhook request before processing the payload.
|