1

I am using WooCommerce Subscription REST API to extend the subscription of the user. The problem that I have is that when I want to update expire time I get this error:

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

Does someone know where is the problem?

I am using the following code to update the subscription expire time:

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

1 Answers1

0

We ran into a similar issue. Instead of passing the whole subscription object back, we instead only passed the necessary information (in our case we wanted to add to the coupon_lines field).

Our resulting payload looked like:

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