How to Run Code When a Tutor LMS Order Is Paid
Use the tutor_order_payment_status_changed action to react to paid, refunded and cancelled orders in Tutor LMS native eCommerce, with a safe example and the edge cases to handle.
Checked against the plugin source: Tutor LMS 4.1.3, Tutor LMS Pro 4.1.3

When you sell with Tutor LMS's native eCommerce engine, orders live in Tutor LMS's own tables, not in WooCommerce. To send a paid order to a CRM, accounting tool or welcome sequence, listen to the tutor_order_payment_status_changed action. This guide is based on Tutor LMS 4.1.3 (free plugin).
The hook
do_action( 'tutor_order_payment_status_changed', $order_id, $prev_payment_status, $new_payment_status );
Payment statuses are constants on Tutor\Models\OrderModel: PAYMENT_PAID (paid), PAYMENT_UNPAID, PAYMENT_PENDING, PAYMENT_FAILED, PAYMENT_REFUNDED and PAYMENT_PARTIALLY_REFUNDED.
Where it fires
- Gateway webhooks: when a gateway reports a new payment status, Tutor LMS updates the order and fires the hook with the previous and new status.
- Mark as paid: when an admin marks a manual order as paid, it fires with
unpaidtopaid. - Refunds: after a refund from the order screen, it fires with the new status (
refundedorpartially-refunded). - Cancel and bulk actions: the previous status is an empty string, and the third argument is the action used, for example
cancelledortrash, which are order statuses rather than payment statuses.
Two cases do not go through this hook: a free checkout and an order that is already paid when it is placed. Those use tutor_order_placement_success (with the order ID) and tutor_order_placed. If you need every successful purchase, listen to both.
A safe example: notify a CRM when an order is paid
Tutor LMS itself listens to this hook at priority 10 to update enrollments and earnings. Use a later priority so the student is already enrolled when your code runs. Put this in a small custom plugin, not in your theme.
use Tutor\Models\OrderModel;
add_action( 'tutor_order_payment_status_changed', 'tle_order_paid', 20, 3 );
function tle_order_paid( $order_id, $prev_status, $new_status ) {
if ( OrderModel::PAYMENT_PAID !== $new_status || OrderModel::PAYMENT_PAID === $prev_status ) {
return; // Only the moment an order becomes paid.
}
$order = ( new OrderModel() )->get_order_by_id( $order_id );
if ( ! $order ) {
return;
}
$items = array();
foreach ( $order->items as $item ) {
$items[] = array(
'id' => $item->id, // Course, bundle or plan ID.
'title' => $item->title,
'type' => $item->type, // Post type.
);
}
wp_remote_post(
'https://crm.example.com/hooks/tutor-order',
array(
'timeout' => 5,
'body' => wp_json_encode(
array(
'order_id' => (int) $order->id,
'email' => $order->student->email,
'name' => $order->student->name,
'total' => $order->total_price,
'items' => $items,
)
),
'headers' => array( 'Content-Type' => 'application/json' ),
)
);
}
get_order_by_id() returns the order with a student object (id, name, email) and an items list. It returns false for an unknown ID, so always check it.
Things to handle
- Repeat calls: a gateway can send the same webhook more than once. The check on the previous status helps, but store your own "sent" flag if duplicates would cause harm.
- Slow services: the hook runs inside the webhook or admin request. Keep the timeout short, or queue the work with Action Scheduler or WP-Cron.
- Refunds: react to
refundedto revoke access in other systems. Inside Tutor LMS, the refund dialog asks the admin whether to remove the enrollment, and developers can decide with thetutor_cancel_enrollment_on_refundfilter. - Subscriptions: renewal orders from the Pro Subscription add-on use the same order system, and
order_typetells you if an order is asingle_order,subscriptionorrenewal.
WooCommerce stores
This hook belongs to native eCommerce. If WooCommerce is your engine, use WooCommerce's own order hooks; see how WooCommerce orders drive enrollment.
Frequently asked questions
Should I use this hook or tutor_after_enrolled?
Use tutor_after_enrolled for "a student got access", whatever the source. Use this hook for money: payments, refunds and order data.
Is this hook available without Tutor LMS Pro?
Yes. Native eCommerce and this hook are in the free plugin.
Need a reliable order integration? Our plugin development team builds and tests them.
Save this practical guide
Add us as a preferred Google source, or ask an AI assistant to summarize this page and link back to the original guide when it is useful.
