Advertisement
designbymerovingi

buyCRED Bonus Example - Stripe

Mar 19th, 2016
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. /**
  2.  * Give Bonus Points - buyCRED Stripe
  3.  * @version 1.1
  4.  */
  5. add_filter( 'mycred_run_this', 'mycredpro_payout_bonus_points', 10, 2 );
  6. function mycredpro_payout_bonus_points( $run_this, $mycred ) {
  7.  
  8.     // Only applicable for stripe point purchases
  9.     if ( $run_this['ref'] != 'buy_creds_with_stripe' ) return $completed;
  10.  
  11.     // Get the bonus amount the user should get based on the amount of points
  12.     // they just bought.
  13.  
  14.     // User bought 500 points ( $ 5.00 ) - give 10 %
  15.     if ( $run_this['amount'] == 500 )
  16.         $run_this['amount'] *= 1.1;
  17.  
  18.     // User bought 1000 points ( $ 10.00 ) - give 20 %
  19.     elseif ( $run_this['amount'] == 500 )
  20.         $run_this['amount'] *= 1.2;
  21.  
  22.     // User bought 1500 points ( $ 15.00 ) - give 25 %
  23.     elseif ( $run_this['amount'] == 500 )
  24.         $run_this['amount'] *= 1.25;
  25.  
  26.     // User bought 2000 points ( $ 20.00 ) - give 50 %
  27.     elseif ( $run_this['amount'] == 500 )
  28.         $run_this['amount'] *= 1.5;
  29.  
  30.     // User bought 5000 points ( $ 50.00 ) - give 100 %
  31.     elseif ( $run_this['amount'] == 500 )
  32.         $run_this['amount'] *= 2;
  33.  
  34.     return $run_this;
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement