What is a webhook?
HTTP POST
request when the event occurs. Webhooks are much more efficient in terms of resources and communication as they can only receive information relatd to desired events without polling data periodically. Using webhooks, you can extend functionality by integrating with custom functions or other applications.
Notifications via webhooks vs. callbacks
paid
)ready
)paid
)paid
or failed
)cancelled
)POST
request is generated for the notification URL endpoint. curl -H "Content-Type: application/json" -X POST -d '{ "imp_uid": "imp_1234567890", "merchant_uid": "order_id_8237352", "status": "paid" }' { NotificationURL }
POST
request contains the following information. The server can get the information and use it to query the payment information from the i'mport server and verify and store the payment information.imp_uid
: payment IDmerchant_uid
: order IDstatus
: payment resultapplication/json
or application/x-www-form-urlencoded
.
To test the callback URL, click the Test Webhook button to the right of the Notification URL field.Testing webhook on localhost
localhost
because localhost
is only accessible from the local machine or shared network.However, if you forward localhost
to a domain accessible from an external network through the ngrok service, you can set the domain as the callback URL.
The following is an example of forwarding the development environment running on localhost:3000
to an externally accessible domain using ngrok. You can test the call by setting that domain as the callback URL.
52.78.100.19
52.78.48.223
Can new client IPs be added?
m_redirect_url
) to the client.m_redirect_url
, payment information is transmitted to the server. The server stores payment information in the database.i'mport does not guarantee the order of payment information delivery