Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
destruk
Streaming Star

push notification failure?

We are not receiving any type of notification.  We've enabled it in our web api screen of the developer account.
To be certain we aren't getting anything, the file it points to simply writes a "1" to a database table.  When calling the link in a browser it works and a 1 is written - but when we do a sale or any billing transaction nothing is written to our database.

<?php
// API access key from Roku API's Console
$ApiKey=...;

// Retrieve the request's body and parse it as JSON
$input=@file_get_contents("php://input");
$event_json=json_decode($input);

//generate required response ASAP to prevent further push notification attempts
$responseKey=$event_json['responseKey'];

//create response array using the response key from above
$fields=array
(
'responseKey'=>$responseKey
);

//set up required headers for response 
$headers=array
(
'ApiKey: ' .$ApiKey,
'accept: application/json',
'Content-Type: application/json'
);

//connect to database
$sitename="localhost";
$masteraccessname=...;
$masteraccesspw=...;
$databasename=...;
$con=@new mysqli($sitename,$masteraccessname,$masteraccesspw,$databasename);
if (mysqli_connect_errno())
{
exit("Unable to connect to database.");
}

//create temp zzz table
// $sql="create table zzz(text varchar(4096))";
// $res=mysqli_query($con, $sql);
$sql="insert into zzz(text) values('1')";
$res=mysqli_query($con, $sql);

//send response body
echo json_encode($fields);
//end of required response
?>

Why isn't roku sending notifications when we told it to?
0 Kudos