# IPN Notification IP Address Validation

Integration security is an absolute priority. To be 100% sure that the received IPN notification actually comes from the SimPay system (and not from a malicious user trying to fraudulently confirm an order payment), **we strongly recommend implementing IP address validation**.

Implementing this mechanism completely prevents *IPN Spoofing* attacks (impersonating our servers).

## How to Properly Verify the Sender?

Our network infrastructure is dynamic, which means that the pool of our IP addresses used for sending webhooks may change. For this reason, the authorization process for each notification should look as follows:

1. When your server receives a POST request (Webhook), read the sender's IP address from the connection header.
2. Then your system makes a quick `GET` request to our public endpoint:
`https://api.simpay.pl/ip`
3. Our API returns the current, authorized list of IP addresses.
4. Compare the webhook sender's IP with the received list. If the address is on the list – the notification is authentic and you can safely update the order status.


### Example Response from the `/ip` Endpoint

When sending a request to `https://api.simpay.pl/ip`, you will receive a response in JSON format containing an array with our current IPv4 addresses.

```json
{
  "success": true,
  "data": [
    "X.X.X.X",
    "Y.Y.Y.Y"
  ]
}
```

## Do Not Cache the Results!

**We absolutely advise against caching (saving in memory) the IP address list retrieved from this endpoint!**

You must query `https://api.simpay.pl/ip` in real time, **with each individual IPN notification** that reaches you.

Why is this so important? Our IP address list can change at any time (e.g., due to maintenance work, security updates, or server scaling). If you save these addresses permanently in the code (so-called hardcoding) or set a long cache time-to-live (TTL), then when SimPay changes its IP:

* Your store will block genuine payment confirmation notifications.
* The system will not deliver goods/services to customers.
* Complaints and support inquiries will start piling up.


Save yourself future problems and always check addresses dynamically in real time!