【问题标题】:Create Offline Refund in Woocommerce在 Woocommerce 中创建离线退款
【发布时间】:2018-12-11 10:42:20
【问题描述】:

我想在 woocommerce 中为订单创建退款,而不使用支付网关。为此,我需要设置属性 api_refund,其默认值为 True 为 False。如何在不更改要发布到 API 的 url 的情况下发送参数?

【问题讨论】:

  • 参数作为请求体传递,而不是在 URL 中。您不更改 URL。详情请参阅api documentation
  • @BurhanKhalid 谢谢你回答我愚蠢的问题,它成功了!

标签: python-3.x woocommerce


【解决方案1】:

我在 React.js 中使用过:


//Action for Full refund Order
const fullRefund = (order_id,net_total) => (dispatch) => {
  const data = {
    amount: "20",
    api_refund:false,
    
  };
  
  apiWoo.post( "orders" + "/" + order_id + "/" + "refunds", data)
    .then((response) => {
      console.log("Response Status:", response.status);
      console.log("Response Headers:", response.headers);
      console.log("Response Data:", response.data);
      console.log("Total of pages:", response.headers['x-wp-totalpages']);
      console.log("Total of items:", response.headers['x-wp-total']);
      alert('Full Refund created for the customer');
    })
    .catch((error) => {
      console.log(error.response.data);
    });

【讨论】:

    猜你喜欢
    • 2020-01-11
    • 2014-10-22
    • 1970-01-01
    • 1970-01-01
    • 2017-04-08
    • 1970-01-01
    • 2019-02-28
    • 2018-02-14
    • 2022-01-19
    相关资源
    最近更新 更多