Woocommerce subscriptions hook scheduled_subscription_payment_ passes parent order instead of a renewall one

I'm trying Paymaster Recurring payments into exsisting payment gateway.

the standart hook calling looks like this

add_action('scheduled_subscription_payment_'. $this->id , array($this, 'scheduled_subscription_payment'), 10, 2);

It's fine and clear. Here's the function processing calling:

function scheduled_subscription_payment( $amount_to_charge, $order ) {
    $this->process_subscription_payment($order, $amount_to_charge);
}

nothing special but there's a problem: according official documentation $order parameter should be automatically created by Woocommerce Subscriptions engine order - but I recieve a parent order which has already been processed.

I initiate payment process by Run button in Sheduled actions: renewal order is created but never passed to the function shown before. What's the problem?

Upvotes: 0

Views: 1195

Answers (1)

Found answer here. One guy faced the same problem so the problem was that hook scheduled_subscription_payment_ had been deprecated and we should use woocommerce_scheduled_subscription_payment_ instead

Upvotes: 1

Related Questions