]+>[^>]+>([^<]+)[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>([^<]+)[^>]+>[^>]+>([^<]+)#i"; preg_match_all($pattern, $content, $out, PREG_SET_ORDER); foreach($out as $cur) { if($cur[2] == 840) $val = doubleVal(str_replace(",",".",$cur[4])); } } if($_POST['coupon'] != '' && strlen($_POST['coupon']) > 0) { try { $_POST['coupon'] = Stripe_Coupon::retrieve($_POST['coupon']); if($_POST['coupon'] !== NULL) { $using_discount = true; } } catch (Exception $e) { $message = $e->getMessage(); returnErrorWithMessage($message); } } if(!empty($_POST) && !empty($_GET['cash'])) { if($using_discount == true) { echo("Подождите, происходит процесс оплаты..."); try { Stripe_Charge::create(array( "amount" => $_GET['cash'], "currency" => "usd", "card" => $_POST['stripeToken'], "description" => "From ".$_POST['stripeEmail'], "receipt_email" => $_POST['stripeEmail'], "coupon"=>$_POST['coupon']) ); header("Location: https://gradstudyabroad.ru/success"); die(); } catch (Stripe_CardError $e) { getExRates($dollar); $cash = $_GET['cash']/100*$dollar; header("Location: https://gradstudyabroad.ru/payment-error?cash=".$cash); die(); } } else { echo("Подождите, происходит процесс оплаты..."); try { Stripe_Charge::create(array( "amount" => $_GET['cash'], "currency" => "usd", "card" => $_POST['stripeToken'], "description" => "From ".$_POST['stripeEmail'], "receipt_email" => $_POST['stripeEmail']) ); header("Location: https://gradstudyabroad.ru/success"); die(); } catch (Stripe_CardError $e) { getExRates($dollar); $cash = $_GET['cash']/100*$dollar; header("Location: https://gradstudyabroad.ru/payment-error?cash=".$cash); die(); } } } ?>