$curl = curl_init();
$data = array(
"amount" => "15",
"currency" => "USD",
"order_id" => "1",
"url_return" => "https://your.site/return",
"url_callback" => "https://your.site/callback"
);
$headers = array(
"merchant: 8b03432e-385b-4670-8d06-064591096795",
"sign: fe99035f86fa436181717b302b95bacff1",
"Content-Type: application/json"
);
$options = array(
CURLOPT_URL => "https://api.cryptomus.com/v1/payment",
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => $headers
);
curl_setopt_array($curl, $options);
$response = curl_exec($curl);
curl_close($curl);
// условие: сумма от 1000 до 1499
if ($woocommerce->cart->total >= $cart_total
&& $woocommerce->cart->total <= 1499) {
if (sizeof($woocommerce->cart->get_cart()) > 0) {
foreach ($woocommerce->cart->get_cart() as $cart_item_key => $values) {
$_product = $values['data'];
if ($_product->get_id() == $product_id)
$found = true;
}
if (!$found)
$woocommerce->cart->add_to_cart($product_id);
} else {
$woocommerce->cart->add_to_cart($product_id);
}
} elseif ($woocommerce->cart->total >= 1500) { // условие: сумма от 1500
/* ... */
}
Route::get('storage/{filename}', function ($filename)
{
$path = storage_path('app\public\\' . $filename);
if (!File::exists($path)) {
abort(404);
}
$file = File::get($path);
$type = File::mimeType($path);
$response = Response::make($file, 200);
$response->header("Content-Type", $type);
return $response;
});