Class Webhook

java.lang.Object
com.stripe.net.Webhook

public final class Webhook extends Object
  • 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 time
      clock - instance of clock if you want to use custom time instance
      Returns:
      the Event instance
      Throws:
      SignatureVerificationException - if the verification fails.