Server-to-Server (S2S) Callback Configuration
You can configure the S2S callback for the offerwall in the dashboard inside the Offerwall's overview section.
1. Setup Callback URL
When a user has earned a reward by completing an offer, we fire an HTTP GET request to the provided callback URL. The following query parameters will be part of the request.
Example callback setup:
Callback URL set by you: http://www.example.com/payments/offers/pubscale
Request sent from us: HTTP GET http://www.example.com/payments/offers/pubscale?user_id=<user_id>&value=<value>&token=<token>&signature=<signature>
user_id
The 'unique_id' set while initializing the SDK.
value
The decimal value of the reward earned by the user.
token
A token that uniquely represents the transaction.
signature
Hash of the above values to verify the request (more info below).
2. Server Response
Responding to the callback URL with status codes between and including the values 200 to 299 will mark the callback as successfully delivered.
In the event of the server not responding with any of the aforementioned status codes, the request will be retried 6 times at different intervals. You can utilize the unique token sent in the request to avoid rewarding the user multiple times for the same callback.
3. Optional Parameters for fraud detection/prevention
3.1. Hash validation
The value sent in the signature parameter can be used to validate the identity of the origin of the request. The value is an MD5 hash of the template below. The secret key is an additional key that will be provided along with the APP API KEY.
Example
secret_key = fa072672-d432-11c4-885a-EB1CdEc4Bb13
user_id = 30356439-8d15-4f47-B133-010a37C19eBD
value = 100.1234
token = 525a5B8e-512b-441A-a10B-72d218c370e5
Final format = fa072672-d432-11c4-885a-EB1CdEc4Bb13.30356439-8d15-4f47-B133-010a37C19eBD.100.525a5B8e-512b-441A-a10B-72d218c370e5
Steps to validate the value of the hash
Concatenate the values in the above format.
Make sure to convert the value parameter from decimal to integer.
Calculate the MD5 hash of the concatenated value.
Build Hex encode of the generated value.
Verify if the calculated value is equal to the value sent in the signature parameter.
As the value of the secret key will only be known to you and PubScale’s server, the hash cannot be generated by a fraudulent third party.
3.2. IP Whitelisting
You can restrict the callbacks to be accepted only from our sever IP address(es). Please whitelist the following IP(s) and regularly check back to find possible changes
Last updated
Was this helpful?