diff --git a/plugins/Paypal/Controllers/PaypalController.php b/plugins/Paypal/Controllers/PaypalController.php index afe572ae..eb05f14f 100644 --- a/plugins/Paypal/Controllers/PaypalController.php +++ b/plugins/Paypal/Controllers/PaypalController.php @@ -69,6 +69,7 @@ class PaypalController $orderNumber = $data['orderNumber']; $customer = current_customer(); $order = OrderRepo::getOrderByNumber($orderNumber, $customer); + $total = round($order->total, 2); $paypalOrder = $this->paypalClient->createOrder([ "intent" => "CAPTURE", @@ -76,7 +77,7 @@ class PaypalController [ "amount" => [ "currency_code" => $order->currency_code, - "value" => $order->total, + "value" => $total, ], 'description' => 'test' ] diff --git a/plugins/Paypal/Views/checkout/payment.blade.php b/plugins/Paypal/Views/checkout/payment.blade.php index e6b7c32a..5c1cf7a7 100644 --- a/plugins/Paypal/Views/checkout/payment.blade.php +++ b/plugins/Paypal/Views/checkout/payment.blade.php @@ -23,10 +23,13 @@ orderNumber: "{{$order->number}}", }) }).then(function (res) { - //res.json(); return res.json(); }).then(function (orderData) { - //console.log(orderData); + if (orderData.error) { + layer.alert(orderData.error.details[0].description, function(index){ + window.location.reload(); + }); + } return orderData.id; }); },