$sslcommerz = new SSLCommerz();
$sslcommerz->setPaymentDisplayType('hosted'); // enum('hosted', 'checkout')
$sslcommerz->setPrimaryInformation([
'total_amount' => (float) Str::round($item->kl_charge_paid),
'currency' => 'USD', //$item->currency,
]);
$sslcommerz->setTranId($this->generateTransaction()); // set your transaction id here
$sslcommerz->setSuccessUrl(route('payment.success'));
$sslcommerz->setFailUrl(route('payment.failed'));
$sslcommerz->setCancelUrl(route('payment.cancel'));
$sslcommerz->setCustomerInformation([
'cus_name' => $buyer->fullName,
'cus_add1' => $buyer->country_id,
'cus_city' => $buyer->country_id,
'cus_postcode' => $buyer->country_id,
'cus_country' => $buyer->country_id,
'cus_email' => $buyer->email,
'cus_phone' => $buyer->mobile,
]);
$sslcommerz->setShipmentInformation([
// 'ship_name' => 'Store Test',
// 'ship_add1' => 'Dhaka',
// 'ship_add2' => 'Dhaka',
// 'ship_city' => 'Dhaka',
// 'ship_state' => 'Dhaka',
// 'ship_postcode' => '1000',
// 'ship_country' => 'Bangladesh',
'shipping_method' => 'NO',
]);
$sslcommerz->setAdditionalInformation([
'value_a' => $type,
'value_b' => $item->item_description['reference_id'],
'value_c' => $buyer->encrypt,
'value_d' => $item->item_id,
]);
$sslcommerz->setEmiOption(0); // enum(1, 0)
$sslcommerz->setProductInformation([
'product_name' => $item->item_description['item_name'],
'product_category' => 'Goods',
'product_profile' => 'physical-goods',
]);
$sslcommerz->setProductAmount((float) Str::round($item->total_amount));
$response = $sslcommerz->initPayment($sslcommerz);
//dd($response);
return redirect()->to($response['GatewayPageURL']); // redirect to gateway page url