Skip to content

Commit

Permalink
fix webhook verification for Java
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-Paystack committed Dec 17, 2024
1 parent 4c8ac65 commit e0c2f5b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/doc/payments/webhooks/verifying-transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class HMacExample {
Mac sha512_HMAC = Mac.getInstance(HMAC_SHA512);
sha512_HMAC.init(keySpec);
byte [] mac_data = sha512_HMAC.
doFinal(body.toString().getBytes("UTF-8"));
doFinal(body.getBytes("UTF-8"));
result = DatatypeConverter.printHexBinary(mac_data);
if(result.toLowerCase().equals(xpaystackSignature)) {
// you can trust the event, it came from paystack
Expand Down
2 changes: 1 addition & 1 deletion src/doc/payments/webhooks/verifying-transaction/index.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void main(String[] args) throws UnsupportedEncodingException, Inva
Mac sha512_HMAC = Mac.getInstance(HMAC_SHA512);
sha512_HMAC.init(keySpec);
byte [] mac_data = sha512_HMAC.
doFinal(body.toString().getBytes("UTF-8"));
doFinal(body.getBytes("UTF-8"));
result = DatatypeConverter.printHexBinary(mac_data);
if(result.toLowerCase().equals(xpaystackSignature)) {
// you can trust the event, it came from paystack
Expand Down

0 comments on commit e0c2f5b

Please # to comment.