frenchbaguette
frenchbaguette

Reputation: 1339

Getting ID of an element. Laravel 5.1

What I need to do is to get the ID of the element.

$price = $_POST['price'];
$orderid = $_POST['id'];
$serverId = 'localhost:8000';


$request = WebToPay::redirectToPayment(array(

    'projectid'     => *****,
    'sign_password' => '************************',
    'orderid'       => $orderid,
    'amount'        => $price * 100,
    'currency'      => 'EUR',
    'country'       => 'LT',
    'accepturl'     => url().'/redirect-to-server/'.$orderid,
    'cancelurl'     => $self_url.'/cancel.php',
    'callbackurl'   => url().'/get-bank-callback',
    'test'          => 1,

This code above redirects me to the accepturl wich is fine. But how I manage to get ID of the file in the accepturl file ?

As you can see in the code above I even post an ID of the element, but I don't know how to get it into the accept.php

This is my accept.php

<?php
$id = $_GET['orderid'];
 ?>


    Thank you for buying <?php echo $id ?>

And it doesn't work like that

Upvotes: 1

Views: 175

Answers (2)

RDelorier
RDelorier

Reputation: 777

Looks like you just need to accept the route param in your handler.

Route::get('/redirect-to-server/{order_id}', function($orderId){})

Upvotes: 1

Amarnasan
Amarnasan

Reputation: 15529

If you want to get the parameter $id through the $_GET global array, you should change the redirect url, so your parameter has a name that can be accessed the way you want:

url().'/redirect-to-server/?orderid='.$orderid

If the redirect fails to work, then maybe you'll want to update the routing.

Upvotes: 1

Related Questions