# ivyforms/trunk/backend/src/Services/Payment/WebhookEventDedupeStore.php

The Innovative Form Builder – IvyForms, version trunk. 33 lines.

- Page: https://pluginprobe.com/plugins/ivyforms/trunk/code/backend/src/Services/Payment/WebhookEventDedupeStore.php
- Raw: https://pluginprobe.com/plugins/ivyforms/trunk/raw/backend/src/Services/Payment/WebhookEventDedupeStore.php
- Modified: 2026-10-05T14:37:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ivyforms/trunk/code/backend/src/Services/Payment/WebhookEventDedupeStore.php#L10-L20`.

```php
<?php

namespace IvyForms\Services\Payment;

/**
 * Deduplicates inbound payment webhooks by provider event id.
 */
class WebhookEventDedupeStore
{
    private const TTL = DAY_IN_SECONDS;

    /**
     * Returns true when this event should be processed (first sighting, or no id to key on).
     */
    public static function claim(string $provider, string $eventId): bool
    {
        $provider = sanitize_key($provider);
        $eventId = sanitize_text_field($eventId);
        if ($provider === '' || $eventId === '') {
            return true;
        }

        $name = 'ivyforms_wh_' . $provider . '_' . md5($eventId);
        if (get_transient($name) !== false) {
            return false;
        }

        set_transient($name, 1, self::TTL);

        return true;
    }
}

```
