Callbacks
It is a good idea to create an IPN listener page on your website and then specify the URL of the listener page in a "Integration → API" section in your Cryptopay account.
It is also important to note that you should use only https
URL. Cryptopay then sends a secure POST request containing payment details of all transaction-related events to the URL.
Handling callbacks correctly is crucial to make sure your integration’s business logic works as expected. It is highly recommended to validate payment statuses and callbacks before acting on it inside your system.
The IPN listener page contains a custom script or a program that gets messages, validates them with Cryptopay, and then passes them to various backend applications for processing.
Acknowledge events immediately
If your callbacks script performs complex logic, or makes network calls, it’s possible that the script would time out before Cryptopay sees its complete execution. Ideally, your callback handler code (notification of an event by returning a 200
status code) is separate from any other logic you do for that event.
Handle duplicate events
Callback endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts. One way of doing this is logging the events you’ve processed, and then not processing the logged ones.
Retry logic
Cryptopay IPN server expects to get a 200
status code from you within 10 seconds. If the response code is different from 200
or a deadline is exceeded, we deliver your callbacks for up to one and a half days with an exponential backoff:
30 + num ^ 4 + num
seconds where num
is 0 to 19 retry
Security
Every callback request contains a X-Cryptopay-Signature
header:
This header contains the hex encoded SHA256 HMAC signature of the callback request body string, computed using your callback Secret as the key.
You receive a callback
You use SHA256 for hashing its body string with a callback secret
You compare
X-Cryptopay-Signature
value to the hash you've got after hashing the callback body string + callback secret
Every new callback request will have a new value of the X-Cryptopay-Signature
header. Make sure you are comparing the hash to the right header.
A callback secret is available in the "Integration → API" section in your Cryptopay account.
Callback IPs
We send all our callbacks from these IP:
Production - 63.33.129.150
Sandbox - 3.249.128.101
You can use these IPs as a whitelist for receiving callbacks.
Callbacks reference can be found in relevant sections of the API reference:
Last updated