Skip to content
Last updated

IPN Notification Structure and Handling

Every IPN notification (Webhook) sent by the SimPay system has a consistent, base structure. Regardless of which event the notification concerns (e.g., a payment made or a refund), the sent request always consists of the same HTTP headers and main JSON elements – a kind of "envelope".


HTTP Headers

Every POST request sent by our servers will contain the following headers. Pay attention to User-Agent, which can serve as a first, preliminary (though insufficient for full security) filter rejecting traffic from bots:

HeaderValue
Content-Typeapplication/json
User-AgentSimPay-IPN/2.0

Technical Requirements

For your system to properly receive notifications from SimPay, it must meet several strict technical conditions:

  1. Public availability: Your IPN endpoint must be exposed on the public Internet. Notifications will not reach local environments (localhost), unless you use tools like ngrok.
  2. Fast response: Our server's waiting time for a response is limited. Heavy operations (sending emails, generating PDFs) must absolutely be delegated to background queue systems.
  3. Correct HTTP response: We expect a specific response confirming receipt of the request. Your server must return one of the following options:
    • Status HTTP 200 OK with the Content-Type: text/plain header and a response body containing only the word OK.
    • Status HTTP 202 Accepted or HTTP 204 No Content (without response body / empty response).

To ensure maximum security and performance, we recommend handling each incoming notification in exactly this order:

  1. IP address verification – check if the sender's IP address is on our list of authorized addresses. Reject the request if the IP does not match.
  2. Signature verification – calculate the hash from the received data and compare it with the signature field. You'll gain 100% certainty that nobody modified the payload in transit.
  3. Type recognition (routing) – read the value from the type field and based on it, delegate data (from the data object) to an asynchronous queue in your system (Queue/Worker).
  4. Connection termination – immediately after sending the task to the background, return a correct response to us (e.g., 200 OK text/plain), closing the connection with the SimPay server.

JSON Structure (Envelope)

When your endpoint receives the request, its body will contain the following fields:

FieldTypeDescription
typestring (Enum)Type of the sent event (e.g., transaction:status_changed). Based on this, you know what schema to expect in the data field.
notification_idchar(36)Unique identifier (UUID) of the specific notification. Allows preventing processing of the same notification multiple times.
datestring (ISO 8601)Date and time of notification generation/sending by our system (e.g., 2025-05-20T16:36:07Z).
dataobjectObject containing detailed business data about the specific event.
signaturestringCryptographic signature (SHA-256 hash) generated from field values. Used to verify notification authenticity.

Example Request

POST /your-ipn-endpoint HTTP/1.1
Host: your-store.com
Content-Type: application/json
User-Agent: SimPay-IPN/2.0

// the sent body is not formatted (does not contain spaces, new lines, etc.)
{
  "type": "transaction:status_changed",
  "notification_id": "0196fec6-7a61-7219-9458-bcc45237c252",
  "date": "2025-05-23T22:12:22+02:00",
  "data": {
    "id": "dbc87423-b121-4ad4-977f-b63c3d3831e8",
    "payer_transaction_id": "Q68KLAKN",
    "service_id": "e65c7519",
    "status": "transaction_failure",
    "amount": {
      "final_currency": "PLN",
      "final_value": "8.00",
      "original_currency": "PLN",
      "original_value": "8.00",
      "commission_system": "0.06",
      "commission_partner": "7.94",
      "commission_currency": "PLN"
    },
    "control": "3e63e31d-f08d-4942-a223-3bad2dce8096",
    "payment": {
      "channel": "blik",
      "type": "blik"
    },
    "customer": {
      "country_code": null
    },
    "created_at": "2024-08-10T15:41:50+02:00"
  },
  "signature": "095a7be5d77c4bab667dbd0f35d9b1cb0c9cec50d8af42842cc37a95b233925e"
}

What's Next?

Now that you know the base structure, it's time to implement security measures and learn about the specific data we send:

👉 Signature Verification and Security – learn how to correctly calculate and verify the hash in step 2.

👉 Event: transaction:status_changed – see the data field structure for the most important event regarding transaction payment.