1 | <?php namespace Arcanedev\Stripe; |
||
12 | abstract class Webhook |
||
13 | { |
||
14 | /* ----------------------------------------------------------------- |
||
15 | | Constants |
||
16 | | ----------------------------------------------------------------- |
||
17 | */ |
||
18 | |||
19 | const DEFAULT_TOLERANCE = 300; |
||
20 | |||
21 | /* ----------------------------------------------------------------- |
||
22 | | Main Methods |
||
23 | | ----------------------------------------------------------------- |
||
24 | */ |
||
25 | |||
26 | /** |
||
27 | * Returns an Event instance using the provided JSON payload. |
||
28 | * |
||
29 | * Throws a `UnexpectedValueException` if the payload is not valid JSON, |
||
30 | * and a `SignatureVerificationException` if the signature verification fails for any reason. |
||
31 | * |
||
32 | * @param string $payload The payload sent by Stripe. |
||
33 | * @param string $sigHeader The contents of the signature header sent by Stripe. |
||
34 | * @param string $secret Secret used to generate the signature. |
||
35 | * @param int $tolerance Maximum difference allowed between the header's timestamp and the current time |
||
36 | * |
||
37 | * @return \Arcanedev\Stripe\Resources\Event the Event instance |
||
38 | * |
||
39 | * @throws UnexpectedValueException |
||
40 | */ |
||
41 | 9 | public static function constructEvent($payload, $sigHeader, $secret, $tolerance = self::DEFAULT_TOLERANCE) |
|
59 | } |
||
60 |