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


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

Default value: false


(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

	public function schedule_recurring_payment( $next_payment_date = false, $gmt = false ) {

		// Unschedule the next action (does nothing if no action scheduled).

		$date = $this->get_recurring_payment_due_date_for_scheduler( $next_payment_date, $gmt );

		if ( is_wp_error( $date ) ) {
			return $date;

		$action_args = $this->get_action_args();

		// Schedule the payment.
		$action_id = as_schedule_single_action(

		 * Fired after a recurring payment is scheduled
		 * @since 5.2.0
		 * @param LLMS_Order $order       LLMS_Order instance.
		 * @param integer    $date        Timestamp of the recurring payment date UTC.
		 * @param array      $action_args Arguments passed to the scheduler.
		 * @param integer    $action_id   Scheduled action ID.
		do_action( 'llms_charge_recurring_payment_scheduled', $this, $date, $action_args, $action_id );

		return $action_id;


Top ↑

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.