helmutschneider / swish-php

PHP-wrapper for the Swish merchant api
MIT License
40 stars 19 forks source link

Empty return on callback #4

Closed maol3 closed 7 years ago

maol3 commented 7 years ago

When I'm performing the payment request my browser prints "NULL" while I get the payment request in my Swish app.

However when the payment is done, Swish returns an empty _POST-array in the callback. I've logged it to database and this is what it returns: https://gyazo.com/ed84a84205992626295d514028791fad

What could be the issue? Thanks in advance!

maol3 commented 7 years ago

Just to make it clear, I've logged serialize($_POST) to the payment_reference column. It's completely empty.

helmutschneider commented 7 years ago

I'm fairly certain swish posts the callback data in JSON. You'll have to decode it manually:

$data = file_get_contents('php://input');
$decoded = json_decode($data, $assoc = true);

// do something with the json array
var_dump($decoded);