dqpdb82600 2018-12-11 11:40
浏览 29

如何使用变量修复Woocommerce Payfast错误?

The supplied variables are not according to specification:

cancel_url : cancel_url must be a valid URL 
notify_url : notify_url must be a valid URL 
return_url : return_url must be a valid URL

The error above pops up when "place order" is pressed on the online store and it redirects to payfast. I am unsure where to set these variables.

And yes, payfast sandbox is DISABLED.

The site was previously working and transactions have been made. Since the WooCommerce and WordPress updates, it is delivering these errors. Is anyone able to please assist me? Contacting WooCommerce has been unsuccessful. I am a front end developer hence why I use WordPress. I am not capable in coding PHP so if any one has some handy php tips to fix this issue, that would be great!

  • 写回答

1条回答 默认 最新

  • dsajdgjadwqe3247382 2018-12-14 13:08
    关注

    PayFast throws this error on the payment page if the provided URLs are not valid, or for local URLs.

    These variables are set in the class-wc-gateway-payfast.php file in the generate_payfast_form function as follows (my current woocommerce-payfast-gateway is v1.4.9):

    'return_url' => $this->get_return_url( $order ),
    'cancel_url' => $order->get_cancel_order_url(),
    'notify_url' => $this->response_url,
    

    You can open the browser's network tab (dev tools) if you wish to see which URLs are being posted through to https://www.payfast.co.za/eng/process. This can help you identify what the problem is by seeing the structure of the URLs being sent through.

    If your situation gets dire, and you are unable to get assistance from the relevant support channels, then you can hardcode the URLs as follows: NOTE: This is a last resort and not recommended!!

    'return_url' => 'https://www.yoursite.com/',
    'cancel_url' => 'https://www.yoursite.com/',
    'notify_url' => 'https://www.yoursite.com/?wc-api=WC_Gateway_PayFast',
    

    If you intend to hard code the URLs until the issue is fixed, then rememeber to first perform a PayFast sandbox test transaction to ensure that your redirect URLs are working, and that the order is updating as expected (correct notify_url).

    评论

报告相同问题?