public/wordpress/wp-content/plugins/wp-courseware/includes/gateways/stripe/stripe-webhooks.php
/**
	 * Stripe Webhook: Customer Subscription Deleted
	 *
	 * Occurs whenever a subscription is deleted.
	 *
	 * @since 4.3.0
	 *
	 * @param object $object The stripe webhook data object.
	 * @param Event  $webhook The stripe webhook event object.
	 * @param bool   $test Is webhook a test webhook? Default is false.
	 */
Stripe Webhook: Customer Subscription Deleted
Occurs whenever a subscription is deleted.




Stripe Webhook : Customer Subscription Deleted Occurs whenever a subscription is deleted .
protected function webhook_customer_subscription_deleted( $object, $webhook, $test = false ) {
		$subscription = wpcw()->subscriptions->get_subscription_by_profile_id( $object->id );
		if ( ! $subscription ) {
			$this->log( sprintf( 'Could not find subscription via subscription id: %s', $object->id ) );
			return;
		}
		if ( $subscription->is_installment_plan() ) {
			$bill_times = $subscription->get_bill_times();
			$instllments_number = $subscription->get_course()->get_installments_number();
			if ( absint( $bill_times ) === absint( $instllments_number ) ) {
				return;
			}
		}
		$subscription->cancel();
	}
protected function webhook_customer_subscription_deleted ( $ object , $ webhook , $ test = false ) { $ subscription = wpcw ( ) -> subscriptions -> get_subscription_by_profile_id ( $ object -> id ) ; if ( ! $ subscription ) { $ this -> log ( sprintf ( 'Could not find subscription via subscription id: %s' , $ object -> id ) ) ; return ; } if ( $ subscription -> is_installment_plan ( ) ) { $ bill_times = $ subscription -> get_bill_times ( ) ; $ instllments_number = $ subscription -> get_course ( ) -> get_installments_number ( ) ; if ( absint ( $ bill_times ) === absint ( $ instllments_number ) ) { return ; } } $ subscription -> cancel ( ) ; }
Stripe Webhook: Customer Subscription Deleted
 Occurs whenever a subscription is deleted.
Stripe Webhook : Customer Subscription Deleted Occurs whenever a subscription is deleted .
// Get Bill Times. // Get installments number. // Check to see if bill times equals the number of installments needed. If so, its already been completed. // Cancel the subscription.