Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在重定向URL中显示Mollie订单状态?_Php_Laravel_Api_Payment Gateway_Mollie - Fatal编程技术网

Php 如何在重定向URL中显示Mollie订单状态?

Php 如何在重定向URL中显示Mollie订单状态?,php,laravel,api,payment-gateway,mollie,Php,Laravel,Api,Payment Gateway,Mollie,重定向URL似乎没有发回任何数据。它似乎使用了GET请求。如何知道返回URL上的付款ID或付款状态 $payment = \mollie::api()->payments()->create([ 'amount' => $price, 'customerId' => $customer->id, 'description' => 'My Initial Payment', 'redirectUrl'

重定向URL似乎没有发回任何数据。它似乎使用了GET请求。如何知道返回URL上的付款ID或付款状态

$payment = \mollie::api()->payments()->create([
    'amount'        => $price,
    'customerId'    => $customer->id,
    'description'   => 'My Initial Payment',
    'redirectUrl'   => \URL::to('/after-payment'),
]);

编辑:正如评论中所指出的,我所说的是webhook URL。马克的回答是正确的,因为他正在描述重定向URL。

如中所述,发送POST请求时带有一个参数
id=tr\uxxxxxx
。您正在发送301或302重定向头吗?在这种情况下,post数据丢失,您将收到GET请求


请注意,如果需要重定向,您始终可以将自己的事务标识符添加到webhook URL。

Daan描述的POST请求仅适用于webhook。Mollie将使用对您提供的重定向URL的GET请求重定向回您的网站。没有数据发送回重定向URL,但是您可以将付款/发票id添加到重定向URL中的GET参数:

$payment = \mollie::api()->payments()->create([
    'amount'        => $price,
    'customerId'    => $customer->id,
    'description'   => 'My Initial Payment',
    'redirectUrl'   => \URL::to('/after-payment').'?invoice_id='.$invoice->id,
]);

您谈论的是另一件事,Webhook的调用而不是重定向的最终调用,重定向是一个GET请求,没有任何参数来标识订单完成的事务(已支付、已取消、已过期等)。但正如Mark de Groot所说,您可以将自己的唯一发票id包含到重定向URL中,然后在调用重定向URL时提取该id。@Bernoulli如果您是正确的,我已在我的答案上方添加了一个通知,指出Mark的正确答案。