Advertisement
verygoodplugins

Untitled

Apr 30th, 2021
1,259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1.     /**
  2.      * Apply Payment Failed tags when a charge fails in Stripe.
  3.      *
  4.      * @since 3.37.13
  5.      *
  6.      * @param \Stripe\Event  $event  Stripe webhook event.
  7.      * @param \Stripe\Charge $charge Stripe Charge.
  8.      */
  9.     public function charge_failed( $event, $charge ) {
  10.  
  11.         $settings = get_post_meta( $charge->metadata->simpay_form_id, 'wpf_settings_simple_pay', true );
  12.  
  13.         if ( empty( $settings ) || false == $settings['enable'] || empty( $settings['apply_tags_payment_failed'] ) ) {
  14.             return;
  15.         }
  16.  
  17.         $user = get_user_by( 'email', $charge->customer->email );
  18.  
  19.         wp_fusion()->user->apply_tags( $settings['apply_tags_payment_failed'], $user->ID );
  20.  
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement