$subtotal = price_format_decimal($this->cart_model->get_sess_cart_total()->subtotal); $cart_items = $this->cart_model->get_sess_cart_items(); $user = user(); $options = $this->initialize_iyzico(); $buyer_id = "guest_" . uniqid(); if (auth_check()) { $buyer_id = user()->id; } $ip = $_SERVER['REMOTE_ADDR']; $country_name = "Turkey"; if(user()->country_id == 222) { $currency = 'TRY'; }else{ $currency = 'USD'; } # create request class $request = new \Iyzipay\Request\CreatePaymentRequest(); $request->setLocale(\Iyzipay\Model\Locale::EN); $request->setConversationId("123456789"); $request->setPrice($subtotal); $request->setPaidPrice($subtotal); $request->setCurrency(\Iyzipay\Model\Currency::USD); $request->setInstallment(1); $request->setBasketId("B678321234"); $request->setPaymentChannel(\Iyzipay\Model\PaymentChannel::WEB); $request->setPaymentGroup(\Iyzipay\Model\PaymentGroup::PRODUCT); $request->setCallbackUrl("https://3dstock.org/cart_controller/iyzico_payment_result"); //credit card info $paymentCard = new \Iyzipay\Model\PaymentCard(); $paymentCard->setCardHolderName($this->input->post('name', true)); $paymentCard->setCardNumber($this->input->post('card_number', true)); $paymentCard->setExpireMonth($this->input->post('month', true)); $paymentCard->setExpireYear($this->input->post('year', true)); $paymentCard->setCvc($this->input->post('cvc', true)); $paymentCard->setRegisterCard(0); $request->setPaymentCard($paymentCard); $buyer = new \Iyzipay\Model\Buyer(); $buyer->setId($user->id); $buyer->setName($user->username); $buyer->setSurname($user->username); //$buyer->setGsmNumber("+905350000000"); $buyer->setEmail($user->email); $buyer->setIdentityNumber("12454670166"); //$buyer->setLastLoginDate("2015-10-05 12:43:35"); //$buyer->setRegistrationDate("2013-04-21 15:12:09"); $buyer->setRegistrationAddress($user->address); $buyer->setIp($ip); $buyer->setCity($this->location_model->get_state(user()->state_id)->name); $buyer->setCountry($this->location_model->get_country(user()->country_id)->name); $buyer->setZipCode($user->zip_code); $request->setBuyer($buyer); $shippingAddress = new \Iyzipay\Model\Address(); $shippingAddress->setContactName($user->username); $shippingAddress->setCity($this->location_model->get_state(user()->state_id)->name); $shippingAddress->setCountry($this->location_model->get_country(user()->country_id)->name); $shippingAddress->setAddress($user->address); $shippingAddress->setZipCode($user->zip_code); $request->setShippingAddress($shippingAddress); $billingAddress = new \Iyzipay\Model\Address(); $billingAddress->setContactName($user->username); $billingAddress->setCity($this->location_model->get_state(user()->state_id)->name); $billingAddress->setCountry($this->location_model->get_country(user()->country_id)->name); $billingAddress->setAddress($user->address); $billingAddress->setZipCode($user->zip_code); $request->setBillingAddress($billingAddress); $basketItems = array(); $count = 0; if (!empty($cart_items)): foreach ($cart_items as $cart_item): $product = get_available_product($cart_item->product_id); $vendor = get_user($product->user_id); //echo $vendor->SubMerchantKey.'
'; //echo $vendor->username.'
'; if (!empty($product)) { $BasketItem = new \Iyzipay\Model\BasketItem(); $BasketItem->setId('8978797987'); $BasketItem->setName('deneme'); $BasketItem->setCategory1(trans("order")); $BasketItem->setItemType(\Iyzipay\Model\BasketItemType::VIRTUAL); $BasketItem->setPrice(price_format_decimal($cart_item->total_price)); $BasketItem->setSubMerchantKey($vendor->SubMerchantKey); $BasketItem->setSubMerchantPrice(price_format_decimal($cart_item->total_price)); $basketItems[$count] = $BasketItem; $count++; } endforeach; endif; $request->setBasketItems($basketItems); # make request //$payment = \Iyzipay\Model\Payment::create($request, $options); $payment = \Iyzipay\Model\ThreedsInitialize::create($request, $options); echo '
';
        print_r($payment);
        echo '
';