Class Webhook.Signature

  • Enclosing class:
    Webhook

    public static final class Webhook.Signature
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String EXPECTED_SCHEME  
    • Constructor Summary

      Constructors 
      Constructor Description
      Signature()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean verifyHeader​(java.lang.String payload, java.lang.String sigHeader, java.lang.String secret, long tolerance)
      Verifies the signature header sent by Stripe.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

    • Constructor Detail

      • Signature

        public Signature()
    • Method Detail

      • verifyHeader

        public static boolean verifyHeader​(java.lang.String payload,
                                           java.lang.String sigHeader,
                                           java.lang.String secret,
                                           long tolerance)
                                    throws SignatureVerificationException
        Verifies the signature header sent by Stripe. Throws a SignatureVerificationException if the 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 allowed between the header's timestamp and the current time
        Throws:
        SignatureVerificationException - if the verification fails.