public/wordpress/wp-content/plugins/wp-courseware/includes/gateways/stripe/stripe-webhooks.php
/**
	 * Stripe Webhook: Customer Subscription Updated
	 *
	 * Occurs whenever a subscription is updated.
	 *
	 * @since 4.3.0
	 *
	 * @param object $object The stripe webhook data object.
	 * @param Event  $webhook The stripe webhook event object.
	 */
Stripe Webhook: Customer Subscription Updated
Occurs whenever a subscription is updated.




Stripe Webhook : Customer Subscription Updated Occurs whenever a subscription is updated .
protected function webhook_customer_subscription_updated( $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;
		}
		$old_amount = $subscription->get_recurring_amount();
		$new_amount = $this->gateway->format_stripe_amount( $object->plan->amount );
		if ( $old_amount !== $new_amount ) {
			$subscription->set_prop( 'recurring_amount', $new_amount );
			$subscription->update_status( sprintf( __( 'Subscription recurring amount changed from %1$s to %2$s in Stripe', 'wp-courseware' ), wpcw_price( $old_amount ), wpcw_price( $new_amount ) ) );
		}
	}
protected function webhook_customer_subscription_updated ( $ 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 ; } $ old_amount = $ subscription -> get_recurring_amount ( ) ; $ new_amount = $ this -> gateway -> format_stripe_amount ( $ object -> plan -> amount ) ; if ( $ old_amount !== $ new_amount ) { $ subscription -> set_prop ( 'recurring_amount' , $ new_amount ) ; $ subscription -> update_status ( sprintf ( __ ( 'Subscription recurring amount changed from %1$s to %2$s in Stripe' , 'wp-courseware' ) , wpcw_price ( $ old_amount ) , wpcw_price ( $ new_amount ) ) ) ; } }
Stripe Webhook: Customer Subscription Updated
 Occurs whenever a subscription is updated.
Stripe Webhook : Customer Subscription Updated Occurs whenever a subscription is updated .