sheenam12

Untitled

May 29th, 2017
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. try{
  2.  
  3. $s_amount = $input['total_payment'];
  4. $percent = ($s_amount * 29)/1000;
  5. $total1 = $percent+0.3;
  6. $total = $s_amount + $total1;
  7.  
  8. $admin_amount = $guard->hourly_rate * $input['billing_hours'];
  9.  
  10. $charge = Stripe::charges()->create([
  11. 'customer' => $cust_id->stripe_customer_id,
  12. 'currency' => 'USD',
  13. 'amount' => $total,
  14. 'application_fee' => $admin_amount,
  15. 'destination' => $guard->stripe_bank_account_id,
  16. ]);
  17.  
  18. }
  19. catch(\Stripe\Error\Card $e) {
  20. return Response::json(array('success'=>'0','errortype'=>$e->getErrorType(), 'msg'=>$e->getMessage()),200);
  21. } catch (\Stripe\Error\RateLimit $e) {
  22. return Response::json(array('success'=>'0','errortype'=>$e->getErrorType(), 'msg'=>$e->getMessage()),200);
  23. } catch (\Stripe\Error\InvalidRequest $e) {
  24. return Response::json(array('success'=>'0','errortype'=>$e->getErrorType(), 'msg'=>$e->getMessage()),200);
  25. } catch (\Stripe\Error\Authentication $e) {
  26. return Response::json(array('success'=>'0','errortype'=>$e->getErrorType(), 'msg'=>$e->getMessage()),200);
  27. } catch (\Stripe\Error\ApiConnection $e) {
  28. return Response::json(array('success'=>'0','errortype'=>$e->getErrorType(), 'msg'=>$e->getMessage()),200);
  29. } catch (\Stripe\Error\Base $e) {
  30. return Response::json(array('success'=>'0','errortype'=>$e->getErrorType(), 'msg'=>$e->getMessage()),200);
  31. } catch (Exception $e) {
  32. return Response::json(array('success'=>'0','errortype'=>0, 'msg'=>$e->getMessage()),200);
  33. }
Add Comment
Please, Sign In to add comment