@@ -54,7 +54,25 @@ protected StripeResponseGetter getResponseGetter() {
54
54
*/
55
55
public ThinEvent parseThinEvent (String payload , String sigHeader , String secret )
56
56
throws SignatureVerificationException {
57
- Signature .verifyHeader (payload , sigHeader , secret , Webhook .DEFAULT_TOLERANCE );
57
+ return parseThinEvent (payload , sigHeader , secret , Webhook .DEFAULT_TOLERANCE );
58
+ }
59
+
60
+ /**
61
+ * Returns an StripeEvent instance using the provided JSON payload. Throws a JsonSyntaxException
62
+ * if the payload is not valid JSON, and a SignatureVerificationException if the signature
63
+ * verification fails for any reason.
64
+ *
65
+ * @param payload the payload sent by Stripe.
66
+ * @param sigHeader the contents of the signature header sent by Stripe.
67
+ * @param secret secret used to generate the signature.
68
+ * @param tolerance number of seconds that the event's timestamp can differ from the system time.
69
+ * Passing `0` will disable the time check entirely and is **strongly discouraged**.
70
+ * @return the StripeEvent instance
71
+ * @throws SignatureVerificationException if the verification fails.
72
+ */
73
+ public ThinEvent parseThinEvent (String payload , String sigHeader , String secret , long tolerance )
74
+ throws SignatureVerificationException {
75
+ Signature .verifyHeader (payload , sigHeader , secret , tolerance );
58
76
59
77
return ApiResource .GSON .fromJson (payload , ThinEvent .class );
60
78
}
0 commit comments