A
A
Anton2018-08-25 01:47:02
Payment systems
Anton, 2018-08-25 01:47:02

How to redirect notifications from payment systems?

Given: online store.
On production , at {prod}/callback.php, notifications about payments from payment systems are sent.
When ordering on the dev server , notifications should go to {dev}/callback.php, which would be processed there.
Question: How to redirect notifications from payment systems? And should they be redirected? Perhaps you just need to curl'om broadcast the headers and the request body to {dev}, get the response and issue it pl. system on the same {prod}.
How are things like this implemented in projects? This is the first time I've encountered such a problem.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2018-08-26
@jezzit

Settled on this one

$result = file_get_contents("{$site}/callback.php?{$_SERVER["QUERY_STRING"]}", false, stream_context_create(array('http' =>
            array(
                'method' => 'POST',
                'header' => "Content-type: application/x-www-form-urlencoded\r\n" .
                    "Authorization: Basic " . base64_encode("dev:$dev_pass"),
                'content' => http_build_query($_POST)
            )
        )));

You can improve on headers in the context through the headers_list () function, but so far too lazy) most payment notifications do not use specific headers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question