【问题标题】:How to add a number of the order to the redirect URL (2checkout)?如何将订单编号添加到重定向 URL(2checkout)?
【发布时间】:2021-08-16 09:58:15
【问题描述】:

我通过付款系统 2checkout.com 设置付款。我的重定向 URL 有问题。付款后我需要重定向到我的网站。我需要重定向 URL 中的订单号。但他不在那里。如何将此参数添加到重定向 URL?

【问题讨论】:

标签: 2checkout


【解决方案1】:

您是否检查了 2checkout 文档中接受的结帐参数?

查找所有可用参数的 2checkout 文档。 https://knowledgecenter.2checkout.com/Documentation/07Commerce/2Checkout-ConvertPlus/ConvertPlus_URL_parameters

【讨论】:

  • 我建议不要在答案中使用修辞问题。他们冒着被误解为根本不是答案的风险。您正在尝试回答此页面顶部的问题,不是吗?否则请删除此帖。
【解决方案2】:

如果您通过\Twocheckout_Charge::form($params, 'auto'); 方法使用托管结帐,则在下订单后使用"return_url" => 'YOUR-RETURN-URL-HERE' 参数在您的自定义 URL 上进行重定向。

您也可以在 return_url 中使用订单号或任何参数,例如:"return_url" => 'yourdomain.com/order-placed/123',"return_url" => 'yourdomain.com/order-placed?order_id=123',

或者,如果您在自己的网站上使用 Checkout 作为费用,请使用以下方法:$charge = \Twocheckout_Charge::auth();,然后尝试以下代码:

if ($charge['response']['responseCode'] == 'APPROVED') 
    {
        $statusMsg = "";
        $statusMsg = '<h2>Thanks for your Order!</h2>';
        $statusMsg .= '<h4>The transaction was successful. Order details are given below:</h4>';
        $statusMsg .= "<p>Response Code: ".$charge['response']['responseCode']."</p>";
        $statusMsg .= "<p>Order ID: ".$charge['response']['orderNumber']."</p>";
        $statusMsg .= "<p>Transaction ID: ".$charge['response']['transactionId']."</p>";
        $statusMsg .= "<p>Order Total: ".$charge['response']['total']." USD</p>";
    }
    else
    {
        $statusMsg = "";
        $statusMsg .= "<p>Transaction Faild. Response Code: ".$charge['response']['responseCode']."</p>";
    }

    REDIRECT HERE: on yourdomain.com/order-placed/$charge['response']['orderNumber']

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-03-02
    • 2017-07-08
    • 1970-01-01
    • 2010-12-15
    • 2018-06-11
    • 1970-01-01
    • 2021-04-19
    • 2020-05-01
    相关资源
    最近更新 更多