首页 文章

WooCommerce自定义支付网关集成没有POST

提问于
浏览
2

我想知道你是否可以帮助我 . 我正在研究与WooCommerce集成的自定义支付网关,现在我被困住了 . 当我点击付款时,我在Chromes控制台中收到500内部服务器错误,它会卡在收据页面中 .

你可以查看我到目前为止所获得的代码

https://github.com/tora-soft/visanet-uy-payment-gateway/blob/master/visanet-uy-payment-gateway.php

它应该生成一个html表单并对支付网关进行POST,用户可以输入他/她的CC详细信息,然后返回 . This is working now

UPDATE Aug 15th

现在该帖子正在运行,但是当从支付网关返回时,登陆默认结帐页面并且不处理结果 .

任何帮助,将不胜感激 .

提前致谢 .

1 回答

  • 3

    @Federico您不应该依赖用户按“返回网站”来接收付款响应有效负载 . 你应该依靠从后端到你后端的IPN响应谈话 . 您的支付提供商告诉用户付款成功并且用户关闭浏览器 .

    步骤1.当用户重定向到VisaNetUY时,让它返回到谢谢URL .

    $return_url = $this->get_return_url($order);
    

    步骤2.将此URL提供给您的支付网关,以便在交易批准时通知您的网站 . (有时称为webhook或ipn响应)

    http://myurl.com/?wc-api=WC_VisaNetUY
    

    第3步 . 您需要删除此行 .

    add_action('woocommerce_thankyou_' . $this->id, array( $this, 'check_response'  ));
    

    步骤4.并使用此行代替:

    add_action('woocommerce_api_wc_visanetuy', array($this, 'check_response') ); 
    //the WC_VisaNetUY from step2 url gets converted to lowercase by wordpress and appended to woocommerce_api_, and if it matches then it calls your function name, in this case it calls your 'check_response', but you could have put any function name here instead of check_reponse in fact some people call it handle_callback or check_ipn_response.
    

    步骤5.不要调用$ order-> reduce_order_stock(),因为$ order-> payment_complete()已经执行减少库存,并为您更改状态 .

相关问题