Skip to content

Commit 107e08d

Browse files
Merge pull request #91 from PaystackOSS/fix/java-webhook
fix webhook verification for Java
2 parents 4c8ac65 + e0c2f5b commit 107e08d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

dist/doc/payments/webhooks/verifying-transaction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public class HMacExample {
6363
Mac sha512_HMAC = Mac.getInstance(HMAC_SHA512);
6464
sha512_HMAC.init(keySpec);
6565
byte [] mac_data = sha512_HMAC.
66-
doFinal(body.toString().getBytes("UTF-8"));
66+
doFinal(body.getBytes("UTF-8"));
6767
result = DatatypeConverter.printHexBinary(mac_data);
6868
if(result.toLowerCase().equals(xpaystackSignature)) {
6969
// you can trust the event, it came from paystack

src/doc/payments/webhooks/verifying-transaction/index.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static void main(String[] args) throws UnsupportedEncodingException, Inva
2727
Mac sha512_HMAC = Mac.getInstance(HMAC_SHA512);
2828
sha512_HMAC.init(keySpec);
2929
byte [] mac_data = sha512_HMAC.
30-
doFinal(body.toString().getBytes("UTF-8"));
30+
doFinal(body.getBytes("UTF-8"));
3131
result = DatatypeConverter.printHexBinary(mac_data);
3232
if(result.toLowerCase().equals(xpaystackSignature)) {
3333
// you can trust the event, it came from paystack

0 commit comments

Comments
 (0)