Skip to main content

Developer Hooks

This page documents key developer hooks for the Divi Membership subscription lifecycle. Use them to run custom code when subscriptions are created, renewed, cancelled, or refunded—useful for custom payment gateways or business logic.

Subscription hooks

Subscription created

Hook: dmem_subscription_created
Fired after a new dmem_subscription post is created.

Example: subscription created
do_action( 'dmem_subscription_created', $subscription_post_id );

Subscriptions are stored as posts of type dmem_subscription with meta such as payment_method, subscription_id, membership_plan, start_date, next_payment_date, cycle_key.

Subscription renewed

Hook: dmem_subscription_renewed
Fired when a subscription is successfully renewed (including manual retries).

Example: subscription renewed
do_action( 'dmem_subscription_renewed', $subscription_id );

Subscription cancelled

Hook: dmem_subscription_cancelled
Fired when a subscription is cancelled and not handled by a built-in gateway.

Example: subscription cancelled
do_action( 'dmem_subscription_cancelled', $subscription_id );

Subscription refunded

Hook: dmem_subscription_refunded
Fired when a refund is issued for a subscription outside of Stripe or PayPal.

Example: subscription refunded
do_action( 'dmem_subscription_refunded', $subscription_id );

Summary table

ActionHook nameParameters
Createdmem_subscription_created$subscription_post_id
Renew / Retrydmem_subscription_renewed$subscription_id
Canceldmem_subscription_cancelled$subscription_id
Refunddmem_subscription_refunded$subscription_id

Custom payment gateway tip

To run your own logic instead of Stripe/PayPal, set:

Example: custom payment method
update_post_meta( $subscription_post_id, 'payment_method', 'n/A' );

The plugin will then rely on your hook handlers for the subscription lifecycle.

What's Next