【问题标题】:WooCommerce REST API: Gateway does not support admin changing the payment method on a SubscriptionWooCommerce REST API:网关不支持管理员更改订阅的付款方式
【发布时间】:2021-07-21 21:08:31
【问题描述】:

我正在使用WooCommerce Subscription REST API 来扩展用户的订阅。我遇到的问题是,当我想更新过期时间时出现此错误:

  Gateway does not support admin changing the payment method on a Subscription

有人知道问题出在哪里吗?

我正在使用以下代码更新订阅过期时间:

   return $this->guzzleClient->request('PUT', 'wp-json/wc/v1/subscriptions/'.$id, [
        'json' => [
            'end_date' => $endDate->toDateTimeString(),
            'status' => 'active',
        ]
    ]);

【问题讨论】:

  • 我也有同样的问题。

标签: wordpress woocommerce woocommerce-rest-api woocommerce-subscriptions


【解决方案1】:

我们遇到了类似的问题。我们没有传递整个订阅对象,而是只传递了必要的信息(在我们的例子中,我们想添加到coupon_lines 字段)。

我们生成的有效载荷如下所示:

{
  coupon_lines: [
    {
      code: "sample-code",
      amount: "10.00"
    }
  ]
}

【讨论】:

    猜你喜欢
    • 2017-04-19
    • 2019-06-24
    • 2019-02-21
    • 2016-12-09
    • 2016-05-07
    • 2021-11-13
    • 2017-05-17
    • 2019-01-12
    • 2016-08-17
    相关资源
    最近更新 更多