🎾 IPN - Webhook
IPN Process
Instant Payment Notification (IPN) is a message service that automatically notifies merchants of payments events.
After the client enters the credit card information and press the charge button he will redirected to the defined thank you page.
Meanwhile iCredit service will send the website server an IPN message, this will be a confirmation of a successful payment from iCredit side.
After the website will get the IPN message and verify that it’s legit the website server can change the order status accordingly as paid.
On the website server side implement an IPN Listener process that will get the IPN message.
The IPN info will change according to the payment type -
- Immediate payment
- J5 (on hold) payment
- Only token
- Recurring sale
(Available examples in the end).
How to Activate
To activate the IPN service, send the parameter "IPNURL" (in payment methods - GetUrl, SaleChargeToken, CreateSale) with a designated URL of the IPN Listener file implemented on the website server side.
Instead of sending the parameter it is possible to save a permanent IPN URL in payment page settings on iCredit management.
Security
Subject to security regulations iCredit server supports this ports -
HTTP (80)
HTTPS (443)
Other ports will be rejected.
The IPN Listener designated URL most be accordingly to the website security protocol.
To handle the IPN and make sure it won’t be blocked please make sure this:
- The server is open to receive POST messages.
- All the path of the IPN URL is open outside.
- If needed add the IPs of iCredit servers for setting it in the client system white list:
- 82.80.194.52
81.218.62.41 31.168.238.28
The merchant server must return a 200 response on the successful IPN message received. iCredit servers receiving time is max 1.25 seconds, after that time passes and called as a timeout, another attempt will be made automatically to send the message. There for, It is important to handle a case of a double IPN, after the IPN received once, the server will save the info needed and will mark the order status as 'paid'. In case that another IPN received, it will be checked and won't affect the order.
IPN Mode – POST/GET
To change default settings of the IPN mode through API send parameter “IPNMethod” (in payment methods - GetUrl, SaleChargeToken, CreateSale).
'IPNMethod'
1 = POST
2 = GET
The common and fastest way to use the IPN is with POST method.
The message will be sent as an array with all the payment and the order details.
In some cases the developer will need to use IPN with GET method instead, usually it happens when the server side is not open for POST, In GET mode the IPN message will be sent to the server with only one value of the SaleID.
After getting the IPN, in either, POST or GET mode, the server will need to valid the IPN source by sending a Verify
method request with three parameters -
'GroupPrivateToken'
- pulled from the system settings.
'TotalAmount'
- pulled from the system orders.
'SaleId'
-
In POST the value will be a part of the message array.
In GET it will be a single value.
If the method returned “Verified” the IPN process will be completed and the server can update the order accordingly.
In case of GET mode, if there’s a need for the rest of the sale information the server can send a SaleDetails method with the SaleId from the IPN to get it in the response.
IPN Failure
The IPN failure will be sent as default to the IPN success URL (IPNURL).
It is possible to send the IPN failure message to a different URL by sending it in the method request parameter -
'IPNFailureURL'
In the payment page, this message will be sent each time the customer will press the charge button and there will be a failure.
Updated about 2 months ago