rcp_membership_payment_profile_canceled

Note: This is part of the developer docs and is considered custom code.
Unfortunately, we cannot provide support for custom code at this time as we do not have the additional resources that would be necessary to provide support for custom code.

If you need assistance with this, please reach out to our list of consultants for further assistance:
https://codeable.io/developers/restrict-content-pro/

Filters whether or not a gateway subscription has been successfully canceled. Third-party gateways should use this to process cancellations and return true if the cancellation was successful, or WP_Error if not.

Parameters:

  • $success (true|WP_Error) - True if the cancellation was successful, WP_Error object if not.
  • $gateway (string) - Gateway slug. Make sure to only process cancellations if this value matches your gateway slug.
  • $gateway_subscription_id (string) - Gateway subscription ID. This is the subscription to cancel in the gateway.
  • $membership_id (int) - ID of the membership being canceled.
  • $membership (RCP_Membership) - Membership object.

Example:

function rcp_elements_cancel( $success, $gateway, $gateway_subscription_id, $membership_id, $membership ) {
	// If it was already cancelled or not Stripe Elements gateway, bail.
	if ( $success || $gateway !== 'stripe_elements' ) {
		return $success;
	}

	return rcp_stripe_cancel_membership( $gateway_subscription_id );
}
add_filter( 'rcp_membership_payment_profile_cancelled', 'rcp_elements_cancel', 10, 5 );
Powered by Zendesk