LLMS_Order::schedule_recurring_payment( string $next_payment_date = false, boolean $gmt = false )

Schedule recurring payment


Description Description

It will unschedule the next recurring payment action, if any, before scheduling.


Top ↑

Parameters Parameters

$next_payment_date

(string) (Optional) Next payment date. If not provided it'll be retrieved using $this->get_next_payment_due_date().

Default value: false

$gmt

(boolean) (Optional) Whether the provided $next_payment_date date is gmt. Default is false. Only applies when the $next_payment_date is provided.

Default value: false


Top ↑

Return Return

(WP_Error|integer) WP_Error if the plan ended. Otherwise returns the return value of as_schedule_single_action: the action's ID.


Top ↑

Source Source

File: includes/models/model.llms.order.php

	 *
	 * Does nothing if no payments are scheduled
	 *
	 * @since 3.0.0
	 * @since 3.32.0 Update to use latest action-scheduler functions.
	 * @since 4.6.0 Use `$this->get_next_scheduled_action_time()` to determine if the action is currently scheduled.
	 *
	 * @return void
	 */
	public function unschedule_recurring_payment() {

		if ( $this->get_next_scheduled_action_time( 'llms_charge_recurring_payment' ) ) {

			$action_args = $this->get_action_args();

			as_unschedule_action( 'llms_charge_recurring_payment', $action_args );

			/**
			 * Fired after a recurring payment is unscheduled
			 *
			 * @since 5.2.0
			 *
			 * @param LLMS_Order $order       LLMS_Order instance.
			 * @param int        $date        Timestamp of the recurring payment date UTC.
			 * @param array      $action_args Arguments passed to the scheduler.
			 */
			do_action( 'llms_charge_recurring_payment_unscheduled', $this, $action_args );

		}

	}

	/**
	 * Schedule recurring payment
	 *


Top ↑

Changelog Changelog

Changelog
Version Description
5.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.