Guest User

Untitled

a guest
Aug 26th, 2019
88
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. try {
  2. $subscription = \Stripe\Subscription::retrieve($customer_data['stripe_subscription_id']);
  3. $updated_subscription = \Stripe\Subscription::update($customer_data['stripe_subscription_id'], [
  4. 'cancel_at_period_end' => false,
  5. 'items' => [
  6. [
  7. 'id' => $subscription->items->data[0]->id,
  8. 'plan' => $membership_tier_new['membership_stripe_id'],
  9. ],
  10. ],[
  11. "metadata" => [
  12. 'file' => __FILE__,
  13. 'line' =>__LINE__,
  14. 'case' => 'update_membership_plan',
  15. 'purpose' => 'subscription_change'
  16. ]
  17. ],
  18. 'prorate' => false,
  19. ]);
  20. $action_details['change_details'] = $action_details['change'].' memebership from '.$membership_tier_old['membership_tier_name'].' to '.$membership_tier_new['membership_tier_name'];
  21.  
  22. }catch(\Stripe\Error\Card $e) {
  23. // Create customer request has been declined
  24. $errors['stripe_error'] = $e->getMessage();
  25. } catch (Exception $e){
  26. $errors['stripe_error'] = $e->getMessage();
  27. }
RAW Paste Data