Documentation
JSON Offer Feed for Virtual Currency API
Introduction
The JSON Offer Feed for Virtual Currency API extension allows you to receive JSON encoded offers by HTTP/HTTPS request.
This extension can be activated for your project by request.
Widget Call parameters
Parameter | Required | Possible values | Description | Example |
---|---|---|---|---|
key | yes | hexadecimal, 32 characters long | Project key | abcdef12345678900987654321abcdef |
page | no | numeric | Number of the page to fetch | |
uid | yes | alphanumeric |
User's unique identifier |
user123, user@mail.com |
widget | yes | alphanumeric |
Widget key |
w1 |
user_agent | yes | alphanumeric |
Mobile Os of the targeted user |
Other Android Windows Mobile iOS Blackberry |
sign_version | yes | 2 | Version of signature. sign_version=2 needs to be used | 2 |
sign | yes | hexadecimal, 32 characters long |
Request signature. All parameters in request need to be |
abcdef12345678900987654321abcdef |
user_ip | yes | IPv4, dotted decimal |
IP address of the end-user |
255.255.255.255 |
Response format:
{"list":[{
"o_name":"Offer name",
"o_description":"Offer description text",
"o_virtual_currency_formatted":"Offer virtual currency label",
"o_virtual_currency":"Offer virtual currency amount",
"o_url":"Offer url",
"o_icon_url":"Offer media (picture, video, etc) url"},...],
"total_count":Total offer amount,
"pager":{"current":current page number,"total":Total number of offer pages,"prev":previous page number,"next":next page number}}
Example request code:
<?php
function generateSignature($params, $secret) {
// work with sorted data
ksort($params);
// generate the base string
$baseString = '';
foreach($params as $key => $value) {
$baseString .= $key . '=' . $value;
}
$baseString .= $secret;
return md5($baseString);
}
$params = array(
'key' => 'cd83cbb752c243999f449416c55e2f53',
'uid' => '218069',
'widget' => 'mw1',
'user_ip' => '127.0.0.1',
'user_agent' => 'iOs',
'sign_version' => 2,
);
$secret = '4c5ee8a5099ece10b5a43cb3bb6a9e03';
$params['sign'] = generateSignature($params, $secret);
$url = 'https://api.paymentwall.com/api/?'. http_build_query($params);
$offers = json_decode(file_get_contents($url));
?>