{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/en/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"IPN Notification Structure and Handling","description":"Znajdziesz tutaj wszystkie niezbędne informacje dotyczące integracji i obsługi systemu płatności SimPay.pl","siteUrl":"https://docs.simpay.pl"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"ipn-notification-structure-and-handling","__idx":0},"children":["IPN Notification Structure and Handling"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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\"."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"http-headers","__idx":1},"children":["HTTP Headers"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Every POST request sent by our servers will contain the following headers. Pay attention to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["User-Agent"]},","," ","which can serve as a first, preliminary (though insufficient for full security) filter rejecting traffic from"," ","bots:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Header"},"children":["Header"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Value"},"children":["Value"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Content-Type"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application/json"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["User-Agent"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SimPay-IPN/2.0"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"technical-requirements","__idx":2},"children":["Technical Requirements"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For your system to properly receive notifications from SimPay, it must meet several strict technical"," ","conditions:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Public availability:"]}," Your IPN endpoint must be exposed on the public Internet. Notifications will not reach"," ","local environments (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["localhost"]},"), unless you use tools like ngrok."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Correct HTTP response:"]}," We expect a specific response confirming receipt of the request. Your server must"," ","return one of the following options:",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Status ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["HTTP 200 OK"]}," with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Content-Type: text/plain"]}," header and a response body containing only the word"," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["OK"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Status ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["HTTP 202 Accepted"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["HTTP 204 No Content"]}," (without response body / empty response)."]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"recommended-handling-order","__idx":3},"children":["Recommended Handling Order"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To ensure maximum security and performance, we recommend handling each incoming notification in"," ","exactly this order:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Signature verification"]}," – calculate the hash from the received data and compare it with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["signature"]}," field. You'll gain 100%"," ","certainty that nobody modified the payload in transit."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Type recognition (routing)"]}," – read the value from the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["type"]}," field and based on it, delegate data (from the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," object)"," ","to an asynchronous queue in your system (Queue/Worker)."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Connection termination"]}," – immediately after sending the task to the background, return a correct response to us (e.g.,"," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["200 OK text/plain"]},"), closing the connection with the SimPay server."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"json-structure-envelope","__idx":4},"children":["JSON Structure (Envelope)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When your endpoint receives the request, its body will contain the following fields:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["type"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}," (Enum)"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Type of the sent event (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transaction:status_changed"]},"). Based on this, you know what schema to expect in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," field."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["notification_id"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["char(36)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Unique identifier (UUID) of the specific notification. Allows preventing processing of the same notification multiple times."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["date"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}," (ISO 8601)"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Date and time of notification generation/sending by our system (e.g., ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["2025-05-20T16:36:07Z"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["object"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Object containing detailed business data about the specific event."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["signature"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Cryptographic signature (SHA-256 hash) generated from field values. Used to verify notification authenticity."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example-request","__idx":5},"children":["Example Request"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /your-ipn-endpoint HTTP/1.1\nHost: your-store.com\nContent-Type: application/json\nUser-Agent: SimPay-IPN/2.0\n\n// the sent body is not formatted (does not contain spaces, new lines, etc.)\n{\n  \"type\": \"transaction:status_changed\",\n  \"notification_id\": \"0196fec6-7a61-7219-9458-bcc45237c252\",\n  \"date\": \"2025-05-23T22:12:22+02:00\",\n  \"data\": {\n    \"id\": \"dbc87423-b121-4ad4-977f-b63c3d3831e8\",\n    \"payer_transaction_id\": \"Q68KLAKN\",\n    \"service_id\": \"e65c7519\",\n    \"status\": \"transaction_failure\",\n    \"amount\": {\n      \"final_currency\": \"PLN\",\n      \"final_value\": \"8.00\",\n      \"original_currency\": \"PLN\",\n      \"original_value\": \"8.00\",\n      \"commission_system\": \"0.06\",\n      \"commission_partner\": \"7.94\",\n      \"commission_currency\": \"PLN\"\n    },\n    \"control\": \"3e63e31d-f08d-4942-a223-3bad2dce8096\",\n    \"payment\": {\n      \"channel\": \"blik\",\n      \"type\": \"blik\"\n    },\n    \"customer\": {\n      \"country_code\": null\n    },\n    \"created_at\": \"2024-08-10T15:41:50+02:00\"\n  },\n  \"signature\": \"095a7be5d77c4bab667dbd0f35d9b1cb0c9cec50d8af42842cc37a95b233925e\"\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"whats-next","__idx":6},"children":["What's Next?"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Now that you know the base structure, it's time to implement security measures and learn about the specific data we send:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["👉 ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/notifications/payment/signature"},"children":["Signature Verification and Security"]}]}," – learn how to correctly calculate and"," ","verify the hash in step 2."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["👉 ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/notifications/payment/events/transaction_status_changed"},"children":["Event: transaction:status_changed"]}]}," – see the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," field structure for"," ","the most important event regarding transaction payment."]}]},"headings":[{"value":"IPN Notification Structure and Handling","id":"ipn-notification-structure-and-handling","depth":1},{"value":"HTTP Headers","id":"http-headers","depth":2},{"value":"Technical Requirements","id":"technical-requirements","depth":2},{"value":"Recommended Handling Order","id":"recommended-handling-order","depth":2},{"value":"JSON Structure (Envelope)","id":"json-structure-envelope","depth":2},{"value":"Example Request","id":"example-request","depth":3},{"value":"What's Next?","id":"whats-next","depth":2}],"frontmatter":{"seo":{"title":"IPN Notification Structure and Handling"}},"lastModified":"2026-05-13T09:55:40.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/en/notifications/payment/structure","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}