Package com.stripe.net
Class Webhook
java.lang.Object
com.stripe.net.Webhook
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
static final class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Event
constructEvent
(String payload, String sigHeader, String secret) Returns an Event instance using the provided JSON payload.static Event
constructEvent
(String payload, String sigHeader, String secret, long tolerance) Returns an Event instance using the provided JSON payload.static Event
constructEvent
(String payload, String sigHeader, String secret, long tolerance, Clock clock) Returns an Event instance using the provided JSON payload.
-
Constructor Details
-
Webhook
public Webhook()
-
-
Method Details
-
constructEvent
public static Event constructEvent(String payload, String sigHeader, String secret) throws SignatureVerificationException Returns an Event instance using the provided JSON payload. Throws a JsonSyntaxException if the payload is not valid JSON, and a SignatureVerificationException if the signature verification fails for any reason.- Parameters:
payload
- the payload sent by Stripe.sigHeader
- the contents of the signature header sent by Stripe.secret
- secret used to generate the signature.- Returns:
- the Event instance
- Throws:
SignatureVerificationException
- if the verification fails.
-
constructEvent
public static Event constructEvent(String payload, String sigHeader, String secret, long tolerance) throws SignatureVerificationException Returns an Event instance using the provided JSON payload. Throws a JsonSyntaxException if the payload is not valid JSON, and a SignatureVerificationException if the signature verification fails for any reason.- Parameters:
payload
- the payload sent by Stripe.sigHeader
- the contents of the signature header sent by Stripe.secret
- secret used to generate the signature.tolerance
- maximum difference in seconds allowed between the header's timestamp and the current time- Returns:
- the Event instance
- Throws:
SignatureVerificationException
- if the verification fails.
-
constructEvent
public static Event constructEvent(String payload, String sigHeader, String secret, long tolerance, Clock clock) throws SignatureVerificationException Returns an Event instance using the provided JSON payload. Throws a JsonSyntaxException if the payload is not valid JSON, and a SignatureVerificationException if the signature verification fails for any reason.- Parameters:
payload
- the payload sent by Stripe.sigHeader
- the contents of the signature header sent by Stripe.secret
- secret used to generate the signature.tolerance
- maximum difference in seconds allowed between the header's timestamp and the current timeclock
- instance of clock if you want to use custom time instance- Returns:
- the Event instance
- Throws:
SignatureVerificationException
- if the verification fails.
-