The Stripe request is failed. Response: { "error": { "message": "Your card was declined.", "type": "card_error", "code": "card_declined", "charge": "ch_18kL6nFzKb8aMux1E1TFKAjq" } } Request: { "amount": 3293865, "capture": false, "currency": "TWD", "description": "A sample description of the order ORD-2016/08-00499, placed in localhost.com by Dmitry Fedyuk.", "metadata": { "Customer Name": "Dmitry Fedyuk", "Order ID": "ORD-2016/08-00499", "Order Items": "New Very Prive", "Store Domain": "localhost.com", "Store Name": "Mage2.PRO", "Store URL": "https://localhost.com:900/store/" }, "receipt_email": null, "shipping": { "address": { "city": "Moscow", "country": "RU", "line1": "Red Square, 1", "line2": "apt. 25", "postal_code": "127238", "state": "Moscow" }, "carrier": "Flat Rate", "name": "Dmitry Fedyuk", "phone": "+79629197300", "tracking_number": null }, "source": "tok_18kL6cFzKb8aMux1LPtdTkLV", "statement_descriptor": "SAMPLE STATEMENT" } ************************************ File: vendor/stripe/stripe-php/lib/ApiRequestor.php Line: 227 Caller: Stripe\ApiRequestor::_interpretResponse Callee: Stripe\ApiRequestor::handleApiError Context: } catch (Exception $e) { $msg = "Invalid response body from API: $rbody " . "(HTTP response code was $rcode)"; throw new Error\Api($msg, $rcode, $rbody); } if ($rcode < 200 || $rcode >= 300) { $this->handleApiError($rbody, $rcode, $rheaders, $resp); } return $resp; } *****************1****************** File: vendor/stripe/stripe-php/lib/ApiRequestor.php Line: 65 Caller: Stripe\ApiRequestor::request Callee: Stripe\ApiRequestor::_interpretResponse Context: $params = array(); } if (!$headers) { $headers = array(); } list($rbody, $rcode, $rheaders, $myApiKey) = $this->_requestRaw($method, $url, $params, $headers); $json = $this->_interpretResponse($rbody, $rcode, $rheaders); $resp = new ApiResponse($rbody, $rcode, $rheaders, $json); return array($resp, $myApiKey); } *****************2****************** File: vendor/stripe/stripe-php/lib/ApiResource.php Line: 120 Caller: Stripe\ApiResource::_staticRequest Callee: Stripe\ApiRequestor::request Context: protected static function _staticRequest($method, $url, $params, $options) { $opts = Util\RequestOptions::parse($options); $requestor = new ApiRequestor($opts->apiKey, static::baseUrl()); list($response, $opts->apiKey) = $requestor->request($method, $url, $params, $opts->headers); foreach ($opts->headers as $k => $v) { if (!array_key_exists($k, self::$HEADERS_TO_PERSIST)) { unset($opts->headers[$k]); } } return array($response, $opts); } *****************3****************** File: vendor/stripe/stripe-php/lib/ApiResource.php Line: 160 Caller: Stripe\ApiResource::_create Callee: Stripe\ApiResource::_staticRequest Context: protected static function _create($params = null, $options = null) { self::_validateParams($params); $base = static::baseUrl(); $url = static::classUrl(); list($response, $opts) = static::_staticRequest('post', $url, $params, $options); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } *****************4****************** File: vendor/stripe/stripe-php/lib/Charge.php Line: 73 Caller: Stripe\Charge::create Callee: Stripe\ApiResource::_create Context: public static function create($params = null, $options = null) { return self::_create($params, $options); } *****************5****************** File: vendor/mage2pro/stripe/Method.php Line: 234 Caller: Dfe\Stripe\Method::Dfe\Stripe\{closure} Callee: Stripe\Charge::create Context: // https://stripe.com/docs/api#capture_charge $charge->capture(); } else { /** @var array(string => mixed) $params */ $params = Charge::request($this->ii(), $this->iia(self::$TOKEN), $amount, $capture); /** @var \Stripe\Charge $charge */ $charge = $this->api($params, function() use($params) {\Stripe\Charge::create($params);}); /** * 2016-03-15 * Информация о банковской карте. * https://stripe.com/docs/api#charge_object-source * https://stripe.com/docs/api#card_object */ /** @var \Stripe\Card $card */ $card = $charge->{'source'}; *****************6****************** File: vendor/mage2pro/stripe/Method.php Line: 312 Caller: Dfe\Stripe\Method::api Callee: Dfe\Stripe\Method::Dfe\Stripe\{closure} Context: private function api(...$args) { /** @var callable $function */ /** @var array(string => mixed) $request */ $args += [1 => []]; list($function, $request) = is_callable($args[0]) ? $args : array_reverse($args); try {S::s()->init(); return $function();} catch (Exception $e) {throw $e;} catch (EStripe $e) {throw new Exception($e, $request);} catch (\Exception $e) {throw df_le($e);} } *****************7****************** File: vendor/mage2pro/stripe/Method.php Line: 234 Caller: Dfe\Stripe\Method::Dfe\Stripe\{closure} Callee: Dfe\Stripe\Method::api Context: // https://stripe.com/docs/api#capture_charge $charge->capture(); } else { /** @var array(string => mixed) $params */ $params = Charge::request($this->ii(), $this->iia(self::$TOKEN), $amount, $capture); /** @var \Stripe\Charge $charge */ $charge = $this->api($params, function() use($params) {\Stripe\Charge::create($params);}); /** * 2016-03-15 * Информация о банковской карте. * https://stripe.com/docs/api#charge_object-source * https://stripe.com/docs/api#card_object */ /** @var \Stripe\Card $card */ $card = $charge->{'source'}; *****************8****************** File: vendor/mage2pro/stripe/Method.php Line: 312 Caller: Dfe\Stripe\Method::api Callee: Dfe\Stripe\Method::Dfe\Stripe\{closure} Context: private function api(...$args) { /** @var callable $function */ /** @var array(string => mixed) $request */ $args += [1 => []]; list($function, $request) = is_callable($args[0]) ? $args : array_reverse($args); try {S::s()->init(); return $function();} catch (Exception $e) {throw $e;} catch (EStripe $e) {throw new Exception($e, $request);} catch (\Exception $e) {throw df_le($e);} } *****************9****************** File: vendor/mage2pro/stripe/Method.php Line: 284 Caller: Dfe\Stripe\Method::charge Callee: Dfe\Stripe\Method::api Context: * Аналогично, иначе операция «void» (отмена авторизации платежа) будет недоступна: * https://github.com/magento/magento2/blob/8fd3e8/app/code/Magento/Sales/Model/Order/Payment.php#L540-L555 * @used-by \Magento\Sales\Model\Order\Payment::canVoid() * Транзакция ситается завершённой, если явно не указать «false». */ $this->ii()->setIsTransactionClosed($capture); } }); } *****************10***************** File: vendor/mage2pro/core/Payment/Method.php Line: 178 Caller: Df\Payment\Method::authorize Callee: Dfe\Stripe\Method::charge Context: * * Самым разумным решением этой проблемы мне показалось * ручное убирание флага IsFraudDetected */ if ($payment instanceof OP) { $payment->setIsFraudDetected(false); } $this->charge($amount, $capture = false); return $this; } *****************11***************** File: app/code/Magento/Sales/Model/Order/Payment/Operations/AuthorizeOperation.php Line: 45 Caller: Magento\Sales\Model\Order\Payment\Operations\AuthorizeOperation::authorize Callee: Df\Payment\Method::authorize Context: // do authorization $order = $payment->getOrder(); if ($isOnline) { // invoke authorization on gateway $method = $payment->getMethodInstance(); $method->setStore($order->getStoreId()); $method->authorize($payment, $amount); } $message = $this->stateCommand->execute($payment, $amount, $order); // update transactions, order state and add comments $transaction = $payment->addTransaction(Transaction::TYPE_AUTH); $message = $payment->prependMessage($message); $payment->addTransactionCommentsToOrder($transaction, $message); *****************12***************** File: app/code/Magento/Sales/Model/Order/Payment/Processor.php Line: 72 Caller: Magento\Sales\Model\Order\Payment\Processor::authorize Callee: Magento\Sales\Model\Order\Payment\Operations\AuthorizeOperation::authorize Context: public function authorize(OrderPaymentInterface $payment, $isOnline, $amount) { return $this->authorizeOperation->authorize($payment, $isOnline, $amount); } *****************13***************** File: app/code/Magento/Sales/Model/Order/Payment.php Line: 1054 Caller: Magento\Sales\Model\Order\Payment::authorize Callee: Magento\Sales\Model\Order\Payment\Processor::authorize Context: public function authorize($isOnline, $amount) { return $this->orderPaymentProcessor->authorize($this, $isOnline, $amount); } *****************14***************** File: var/generation/Magento/Sales/Model/Order/Payment/Interceptor.php Line: 427 Caller: Magento\Sales\Model\Order\Payment::authorize Callee: Magento\Sales\Model\Order\Payment::authorize Context: public function authorize($isOnline, $amount) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'authorize'); if (!$pluginInfo) { return parent::authorize($isOnline, $amount); } else { return $this->___callPlugins('authorize', func_get_args(), $pluginInfo); } } *****************15***************** File: app/code/Magento/Sales/Model/Order/Payment.php Line: 421 Caller: Magento\Sales\Model\Order\Payment::processAction Callee: Magento\Sales\Model\Order\Payment::authorize Context: $baseTotalDue = $order->getBaseTotalDue(); switch ($action) { case \Magento\Payment\Model\Method\AbstractMethod::ACTION_ORDER: $this->_order($baseTotalDue); break; case \Magento\Payment\Model\Method\AbstractMethod::ACTION_AUTHORIZE: $this->authorize(true, $baseTotalDue); // base amount will be set inside $this->setAmountAuthorized($totalDue); break; case \Magento\Payment\Model\Method\AbstractMethod::ACTION_AUTHORIZE_CAPTURE: $this->setAmountAuthorized($totalDue); $this->setBaseAmountAuthorized($baseTotalDue); $this->capture(null); break; *****************16***************** File: app/code/Magento/Sales/Model/Order/Payment.php Line: 348 Caller: Magento\Sales\Model\Order\Payment::place Callee: Magento\Sales\Model\Order\Payment::processAction Context: $orderState = $stateObject->getData('state') ?: $orderState; $orderStatus = $stateObject->getData('status') ?: $orderStatus; $isCustomerNotified = $stateObject->hasData('is_notified') ? $stateObject->getData('is_notified') : $isCustomerNotified; } else { $orderState = Order::STATE_PROCESSING; $this->processAction($action, $order); $orderState = $order->getState() ? $order->getState() : $orderState; $orderStatus = $order->getStatus() ? $order->getStatus() : $orderStatus; } } else { $order->setState($orderState) ->setStatus($orderStatus); } *****************17***************** File: var/generation/Magento/Sales/Model/Order/Payment/Interceptor.php Line: 167 Caller: Magento\Sales\Model\Order\Payment::place Callee: Magento\Sales\Model\Order\Payment::place Context: public function place() { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'place'); if (!$pluginInfo) { return parent::place(); } else { return $this->___callPlugins('place', func_get_args(), $pluginInfo); } } *****************18***************** File: app/code/Magento/Sales/Model/Order.php Line: 871 Caller: Magento\Sales\Model\Order::_placePayment Callee: Magento\Sales\Model\Order\Payment::place Context: protected function _placePayment() { $this->getPayment()->place(); return $this; } *****************19***************** File: app/code/Magento/Sales/Model/Order.php Line: 1060 Caller: Magento\Sales\Model\Order::place Callee: Magento\Sales\Model\Order::_placePayment Context: public function place() { $this->_eventManager->dispatch('sales_order_place_before', ['order' => $this]); $this->_placePayment(); $this->_eventManager->dispatch('sales_order_place_after', ['order' => $this]); return $this; } *****************20***************** File: var/generation/Magento/Sales/Model/Order/Interceptor.php Line: 479 Caller: Magento\Sales\Model\Order::place Callee: Magento\Sales\Model\Order::place Context: public function place() { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'place'); if (!$pluginInfo) { return parent::place(); } else { return $this->___callPlugins('place', func_get_args(), $pluginInfo); } } *****************21***************** File: app/code/Magento/Sales/Model/Service/OrderService.php Line: 190 Caller: Magento\Sales\Model\Service\OrderService::place Callee: Magento\Sales\Model\Order::place Context: public function place(\Magento\Sales\Api\Data\OrderInterface $order) { // transaction will be here //begin transaction try { $order->place(); return $this->orderRepository->save($order); //commit } catch (\Exception $e) { throw $e; //rollback; } } *****************22***************** File: app/code/Magento/Quote/Model/QuoteManagement.php Line: 488 Caller: Magento\Quote\Model\QuoteManagement::submitQuote Callee: Magento\Sales\Model\Service\OrderService::place Context: 'sales_model_service_quote_submit_before', [ 'order' => $order, 'quote' => $quote ] ); try { $order = $this->orderManagement->place($order); $quote->setIsActive(false); $this->eventManager->dispatch( 'sales_model_service_quote_submit_success', [ 'order' => $order, 'quote' => $quote ] ); *****************23***************** File: app/code/Magento/Quote/Model/QuoteManagement.php Line: 391 Caller: Magento\Quote\Model\QuoteManagement::submit Callee: Magento\Quote\Model\QuoteManagement::submitQuote Context: public function submit(QuoteEntity $quote, $orderData = []) { if (!$quote->getAllVisibleItems()) { $quote->setIsActive(false); return null; } return $this->submitQuote($quote, $orderData); } *****************24***************** File: app/code/Magento/Quote/Model/QuoteManagement.php Line: 349 Caller: Magento\Quote\Model\QuoteManagement::placeOrder Callee: Magento\Quote\Model\QuoteManagement::submit Context: $quote->setCustomerEmail($quote->getBillingAddress()->getEmail()); $quote->setCustomerIsGuest(true); $quote->setCustomerGroupId(\Magento\Customer\Api\Data\GroupInterface::NOT_LOGGED_IN_ID); } $this->eventManager->dispatch('checkout_submit_before', ['quote' => $quote]); $order = $this->submit($quote); if (null == $order) { throw new LocalizedException( __('An error occurred on the server. Please try to place the order again.') ); } $this->checkoutSession->setLastQuoteId($quote->getId()); *****************25***************** File: vendor/mage2pro/core/Payment/PlaceOrderInternal.php Line: 26 Caller: Df\Payment\PlaceOrderInternal::_place Callee: Magento\Quote\Model\QuoteManagement::placeOrder Context: /** @var IQM|QM $qm */ $qm = df_o(IQM::class); /** @var mixed $result */ try { BillingAddress::disable(!$this->ss()->askForBillingAddress()); try { /** @var int $orderId */ $orderId = $qm->placeOrder($this->quoteId()); } finally { BillingAddress::restore(); } $result = df_order($orderId)->getPayment()->getAdditionalInformation(PlaceOrder::DATA); } catch (\Exception $e) { throw new CouldNotSaveException(__($this->message($e)), $e); *****************26***************** File: vendor/mage2pro/core/Payment/PlaceOrderInternal.php Line: 179 Caller: Df\Payment\PlaceOrderInternal::p Callee: Df\Payment\PlaceOrderInternal::_place Context: public static function p($cartId, $isGuest) { return (new self([self::$P__GUEST => $isGuest, self::$P__QUOTE_ID => $cartId]))->_place(); } *****************27***************** File: vendor/mage2pro/core/Payment/PlaceOrder.php Line: 47 Caller: Df\Payment\PlaceOrder::registered Callee: Df\Payment\PlaceOrderInternal::p Context: public function registered($cartId, IPayment $paymentMethod, IAddress $billingAddress = null) { /** @var IRegistered|Registered $iRegistered */ $iRegistered = df_o(IRegistered::class); $iRegistered->savePaymentInformation($cartId, $paymentMethod, $billingAddress); return PlaceOrderInternal::p($cartId, false); } *****************28***************** Caller: call_user_func_array Callee: Df\Payment\PlaceOrder::registered *****************29***************** File: app/code/Magento/Webapi/Controller/Rest.php Line: 307 Caller: Magento\Webapi\Controller\Rest::processApiRequest Callee: call_user_func_array Context: $route = $this->getInputParamsResolver()->getRoute(); $serviceMethodName = $route->getServiceMethod(); $serviceClassName = $route->getServiceClass(); $service = $this->_objectManager->get($serviceClassName); /** @var \Magento\Framework\Api\AbstractExtensibleObject $outputData */ $outputData = call_user_func_array([$service, $serviceMethodName], $inputParams); $outputData = $this->serviceOutputProcessor->process( $outputData, $serviceClassName, $serviceMethodName ); if ($this->_request->getParam(FieldsFilter::FILTER_PARAMETER) && is_array($outputData)) { $outputData = $this->fieldsFilter->filter($outputData); } *****************30***************** File: app/code/Magento/Webapi/Controller/Rest.php Line: 216 Caller: Magento\Webapi\Controller\Rest::dispatch Callee: Magento\Webapi\Controller\Rest::processApiRequest Context: $this->_request->setPathInfo($path); $this->areaList->getArea($this->_appState->getAreaCode()) ->load(\Magento\Framework\App\Area::PART_TRANSLATE); try { if ($this->isSchemaRequest()) { $this->processSchemaRequest(); } else { $this->processApiRequest(); } } catch (\Exception $e) { $maskedException = $this->_errorProcessor->maskException($e); $this->_response->setException($maskedException); } return $this->_response; } *****************31***************** File: var/generation/Magento/Webapi/Controller/Rest/Interceptor.php Line: 37 Caller: Magento\Webapi\Controller\Rest::dispatch Callee: Magento\Webapi\Controller\Rest::dispatch Context: public function dispatch(\Magento\Framework\App\RequestInterface $request) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'dispatch'); if (!$pluginInfo) { return parent::dispatch($request); } else { return $this->___callPlugins('dispatch', func_get_args(), $pluginInfo); } } *****************32***************** File: lib/internal/Magento/Framework/App/Http.php Line: 135 Caller: Magento\Framework\App\Http::launch Callee: Magento\Webapi\Controller\Rest::dispatch Context: public function launch() { $areaCode = $this->_areaList->getCodeByFrontName($this->_request->getFrontName()); $this->_state->setAreaCode($areaCode); $this->_objectManager->configure($this->_configLoader->load($areaCode)); /** @var \Magento\Framework\App\FrontControllerInterface $frontController */ $frontController = $this->_objectManager->get(\Magento\Framework\App\FrontControllerInterface::class); $result = $frontController->dispatch($this->_request); // TODO: Temporary solution until all controllers return ResultInterface (MAGETWO-28359) if ($result instanceof ResultInterface) { $this->registry->register('use_page_cache_plugin', true, true); $result->renderResult($this->_response); } elseif ($result instanceof HttpInterface) { $this->_response = $result; } else { throw new \InvalidArgumentException('Invalid return type'); *****************33***************** File: lib/internal/Magento/Framework/App/Bootstrap.php Line: 258 Caller: Magento\Framework\App\Bootstrap::run Callee: Magento\Framework\App\Http::launch Context: try { try { \Magento\Framework\Profiler::start('magento'); $this->initErrorHandler(); $this->initObjectManager(); $this->assertMaintenance(); $this->assertInstalled(); $response = $application->launch(); $response->sendResponse(); \Magento\Framework\Profiler::stop('magento'); } catch (\Exception $e) { \Magento\Framework\Profiler::stop('magento'); if (!$application->catchException($this, $e)) { throw $e; } } *****************34***************** File: index.php Line: 39 Callee: Magento\Framework\App\Bootstrap::run Context: HTML; exit(1); } $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER); /** @var \Magento\Framework\App\Http $app */ $app = $bootstrap->createApplication(\Magento\Framework\App\Http::class); $bootstrap->run($app);