Support Center

How can I retrieve a notification ?

The notification is sent by Slimpay in a JSON format. So you have to retrieve the body entirely and then parse this body. As the body does not parse naturally the JSON, you have to do it "by hand" otherwise we can believe that the notification is empty.Two examples, below : $body = file_get_contents("php://input"); // string of the whole body
$json = json_decode($body, true); // array of the whole body

With the PHP client given by Slimpay :
$body = file_get_contents("php://input"); // string of the whole body
$resource = \HapiClient\Hal\Resource::fromJson($body); // \HapiClient\Hal\Resource Object
$state = $resource->getState(); // array of the state of the resource (all the properties except the _links

Questo articolo ti è stato utile?
Utenti che ritengono sia utile: 0 su 0