$webhook['id'], 'url' => $webhook['url'], 'webhook_events' => $webhook['webhook_events'] ?? [], 'signing_secret' => $webhook['signing_secret'], ] ) ) ); } /** * Get registered webhook. * * @return array|null */ public function get() { $webhook = json_decode( Encryption::decrypt( (string) get_option( self::REGISTERED_WEBHOOK_KEY, '' ) ), true ); if ( empty( $webhook['signing_secret'] ) ) { return null; } $webhook['signing_secret'] = $webhook['signing_secret']; return new Webhook( $webhook ); } /** * Delete the registered webhook. * * @return boolean */ public function delete(): bool { return delete_option( self::REGISTERED_WEBHOOK_KEY ); } }