Thursday, May 10, 2018

How can we get posted data to my url from a third party website in laravel5.6? - development

How can we get posted data to my url from a third party website in laravel5.6?

I have a website. It is created using laravel 5.6. I integrated a payment gateway (payone) that is working fine. I can do test transactions. But I don’t know how can I capture the post data posted by payment gateway to my url (https://demo.project.de/payment/response). I had tried some functionality but not working. Here is my code. Any help will be appreciated.

routes->web.php

Route for getting post from payment gateway (payone)

Route::post('/payment/response', 'PaymentController@response')->name('payment.response');

PaymentController.php

public function response()
    {
        // you'll need to include the $defaults array somehow, or at least get the key from a secret configuration file
        if ($_POST["key"] == hash("md5", env('KEY'))) {
            // key is valid, this notification is for us
            echo "TSOK";
            if ($_POST["txaction"] == "appointed") {
                dd($_POST);
                // a freshly created transaction has been marked successfully initiated
                // update that transaction accordingly, e.g. by $_POST["reference"]
            }
            if ($_POST["txaction"] == "paid") {
                dd($_POST);
                // update your transaction accordingly, e.g. by $_POST["reference"]
            }
        }
    }

Payone response

response of your webserver:

<!DOCTYPE HTML> <HTML LANG="EN"> <HEAD> <META CHARSET="UTF-8"> <META HTTP-EQUIV="X-UA-COMPATIBLE" CONTENT="IE=EDGE"> <META NAME="VIEWPORT" CONTENT="WIDTH=DEVICE-WIDTH, INITIAL-SCALE=1"> <TITLE>PAGE EXPIRED</TITLE> <!-- FONTS --> <LINK HREF="HTTPS://FONTS.GOOGLEAPIS.COM/CSS?FAMILY =RALEWAY:100,600" REL="STYLESHEET" TYPE="TEXT/CSS"> <!-- STYLES --> <STYLE> HTML, BODY { BACKGROUND-COLOR: #FFF; COLOR: #636B6F; FONT-FAMILY: 'RALEWAY', SANS-SERIF; FONT-WEIGHT: 100; HEIGHT: 100VH; MARGIN: 0; } .FULL-HEIGHT { HEIGHT: 100VH; } .FLEX-CENTER { ALIGN-ITEMS: CENTER; DISPLAY: FLEX; JUSTIFY-CONTENT: CENTER; } .POSITION-REF { POSITION: RELATIVE; } .CONTENT {



from Laravel Questions and Answers https://laravelquestions.com/php/how-can-we-get-posted-data-to-my-url-from-a-third-party-website-in-laravel5-6/
via Lzo Media

No comments:

Post a Comment