Ejemplo n.º 1
0
 def _get_response_data(self, iyzico_txn_values: dict) -> dict:
     try:
         checkout_form_initialize = iyzipay.CheckoutFormInitialize().create(
             self._get_request_dict(iyzico_txn_values),
             self._get_option_dict())
         response = self._get_response_elements(
             ast.literal_eval(
                 checkout_form_initialize.read().decode('utf-8')))
     except Exception as e:
         raise UserError(e)
     return response
    {
        'id': 'BI103',
        'name': 'Usb',
        'category1': 'Electronics',
        'category2': 'Usb / Cable',
        'itemType': 'PHYSICAL',
        'price': '0.2'
    }
]

request = {
    'locale': 'tr',
    'conversationId': '123456789',
    'price': '1',
    'paidPrice': '1.2',
    'currency': 'TRY',
    'basketId': 'B67832',
    'paymentGroup': 'PRODUCT',
    "callbackUrl": "https://www.merchant.com/callback",
    "enabledInstallments": ['2', '3', '6', '9'],
    'buyer': buyer,
    'shippingAddress': address,
    'billingAddress': address,
    'basketItems': basket_items,
    'debitCardAllowed': true
}

checkout_form_initialize = iyzipay.CheckoutFormInitialize().create(request, options)

print(checkout_form_initialize.read().decode('utf-8'))
Ejemplo n.º 3
0
def processOrder(request):    
    transaction_id = datetime.datetime.now().timestamp()
    data = json.loads(request.body)
    #guest = guestOrder(request, data)

    if request.user.is_authenticated:
        customer = request.user.customer
        order, created = Order.objects.get_or_create(customer=customer, complete=False)
    else:
        customer, order = guestOrder(request, data)

    total = float(data['form']['total'])
    order.transaction_id = transaction_id

    if total == order.get_cart_total:
        order.complete = True
    order.save()

    if order.shipping == True:
        ShippingAddress.objects.create(
        customer=customer,
        order=order,
        address=data['shipping']['address'],
        city=data['shipping']['city'],
        state=data['shipping']['state'],
        zipcode=data['shipping']['zipcode'],
        )

    #if customer == 'AnonymousUser':
    #    customer = guest['customer']

    # --------------------------------------------------------
    # Start iyzico processing here 
    # --------------------------------------------------------   
    #
    print("cust name: ",customer.name)
    print("cust email: ",customer.email)
    print("city: ",data['shipping']['city'])

    options = {
        'api_key': "sandbox-1f34H4ijbsKwKTNpOO819uVcmeKVFVru",
        'secret_key': "sandbox-IEdqibHjYkwQND2pGYiefrjHaFz6uLAv",
        'base_url': iyzipay.base_url
    }

    #payment_card = {
    #    'cardHolderName': 'John Doe',
    #    'cardNumber': '5528790000000008',
    #    'expireMonth': '12',
    #    'expireYear': '2030',
    #    'cvc': '123',
    #    'registerCard': '0'
    #}

    buyer = {
        'id': 'BY789',
        'name': customer.name,
        'surname': customer.name,
        'gsmNumber': '+905350000000',
        'email': customer.email,
        'identityNumber': '74300864791',
        'lastLoginDate': '2015-10-05 12:43:35',
        'registrationDate': '2013-04-21 15:12:09',
        'registrationAddress': data['shipping']['address'],
        'ip': '85.34.78.112',
        'city': data['shipping']['city'],
        'country': data['shipping']['state'],
        'zipCode': data['shipping']['zipcode']
    }


    address = {
        'contactName': customer.name,
        'city': data['shipping']['city'],
        'country': data['shipping']['state'],
        'zipCode': data['shipping']['zipcode'],
        'address': data['shipping']['address'],
    }



    basket_items = []
    total_price = 0
    basket_id_prfx = 'BI10'
    ind = 0
    orderitems = order.orderitem_set.all()
    print("len orders: ", len(orderitems))
    for item in orderitems:
        basket_item = {}
        basket_item['id'] = basket_id_prfx + str(ind)
        basket_item['name'] = item.product.name
        print("prod name: ", item.product.name)
        basket_item['category1'] = 'Collectibles'
        basket_item['category2'] = 'Accessories'
        basket_item['itemType'] = 'PHYSICAL'
        basket_item['price'] = round(item.product.price * item.quantity, 1)
        basket_items.append(basket_item)
        total_price += round (item.product.price * item.quantity, 1)
        ind +=1 

    print(basket_items)

    print('price: ', str(order.get_cart_total))
    print('total calc price: ', str(total_price))
    print('paidPrice: ', str(order.get_cart_total + order.get_cart_total*0.2))
    #        'paymentCard': payment_card,
    request = {
        'locale': 'tr',
        'conversationId': '123456789',
        'price': str(total_price),
        'paidPrice': str(total_price + total_price*0.2),
        'currency': 'TRY',
        'basketId': 'B67832',
        'paymentGroup': 'PRODUCT',

        #"callbackUrl": "http://127.0.0.1:8000",
        "callbackUrl": "http://127.0.0.1:8000/successful/",
        'installment': '1',
        'buyer': buyer,
        'shippingAddress': address,
        'billingAddress': address,
        'basketItems': basket_items,
    }

    print('request......\n',request)
    checkout_form_initialize = iyzipay.CheckoutFormInitialize().create(request, options)
    form_init = checkout_form_initialize.read().decode('utf-8')
    d = json.loads(form_init)
    print(d)
    print(d['paymentPageUrl'])
    print(d['checkoutFormContent'])
    context = {'iyzipay-checkout-form': d['checkoutFormContent']}
    show = d['checkoutFormContent'] + '<div id="iyzipay-checkout-form" class="popup"></div>'
    
    #return render(request, 'store/iyzico.html', context)
    #return JsonResponse(d['checkoutFormContent'], safe = False)
    #return JsonResponse(form_init, safe = False)
    return JsonResponse(d)
Ejemplo n.º 4
0
def iyzico(request):
    options = {
    'api_key': "sandbox-mMFmAU9sflXazllrL23bEeCJTHVvL7kh",
    'secret_key': "sandbox-RW0d1D8guLJTMo2PlI51eAzqPSQY8QLz",
    'base_url': iyzipay.base_url
    }


    #------------------
    payment_card = {
        'cardHolderName': 'John Doe',
        'cardNumber': '5528790000000008',
        'expireMonth': '12',
        'expireYear': '2030',
        'cvc': '123',
        'registerCard': '0'
    }

    buyer = {
        'id': 'BY789',
        'name': 'John',
        'surname': 'Doe',
        'gsmNumber': '+905350000000',
        'email': '*****@*****.**',
        'identityNumber': '74300864791',
        'lastLoginDate': '2015-10-05 12:43:35',
        'registrationDate': '2013-04-21 15:12:09',
        'registrationAddress': 'Nidakule Goztepe, Merdivenkoy Mah. Bora Sok. No:1',
        'ip': '85.34.78.112',
        'city': 'Istanbul',
        'country': 'Turkey',
        'zipCode': '34732'
    }

    address = {
        'contactName': 'John Doe',
        'city': 'Istanbul',
        'country': 'Turkey',
        'address': 'Nidakule Goztepe, Merdivenkoy Mah. Bora Sok. No:1',
        'zipCode': '34732'
    }

    basket_items = [
        {
            'id': 'BI101',
            'name': 'Binocular',
            'category1': 'Collectibles',
            'category2': 'Accessories',
            'itemType': 'PHYSICAL',
            'price': '0.3'
        },
        {
            'id': 'BI102',
            'name': 'Game code',
            'category1': 'Game',
            'category2': 'Online Game Items',
            'itemType': 'VIRTUAL',
            'price': '0.5'
        },
        {
            'id': 'BI103',
            'name': 'Usb',
            'category1': 'Electronics',
            'category2': 'Usb / Cable',
            'itemType': 'PHYSICAL',
            'price': '0.2'
        },
        {
            'id': 'BI104',
            'name': 'Usb',
            'category1': 'Electronics',
            'category2': 'Usb / Cable',
            'itemType': 'PHYSICAL',
            'price': '0.4'
        }
    ]

    #----------------------

    request = {
        'locale': 'tr',
        'conversationId': '123456789',
        'price': '1.4',
        'paidPrice': '2.68',
        'currency': 'TRY',
        'basketId': 'BI67832',
        'paymentGroup': 'PRODUCT',
        
        "callbackUrl": "http://127.0.0.1:8000/",
        'installment': '1',
        'buyer': buyer,
        'shippingAddress': address,
        'billingAddress': address,
        'basketItems': basket_items,
    }
    print("what is going on.....\n")
    print(".........working request...... \n", request)
    checkout_form_initialize = iyzipay.CheckoutFormInitialize().create(request, options)
    form_init = checkout_form_initialize.read().decode('utf-8')
    d = json.loads(form_init)
    print(d['paymentPageUrl'])
    print(d['checkoutFormContent'])
    context = {'iyzipay-checkout-form': d['checkoutFormContent']}
    show = d['checkoutFormContent'] + '<div id="iyzipay-checkout-form" class="popup"></div>'
    #return render(request, '<html><body> deneme </body></html>')
    #return render(request, 'store/iyzico.html', context)
    #return JsonResponse(d['checkoutFormContent'], safe = False)
    return JsonResponse(d)
Ejemplo n.º 5
0
def payment_iyzico(request, siparis):
    order = Order.objects.get(pk=siparis)

    iyzico = PaymentMethodIyzico.objects.get(payment_type__name='Iyzico')
    order_products = OrderProduct.objects.filter(order=order)
    x = request

    user_basket = []
    user_basket1 = ['1', '2', '3', '4']

    options = {
        'api_key': iyzico.apiKey,
        'secret_key': iyzico.secretKey,
        'base_url': iyzipay.base_url,
    }

    request = dict([('locale', 'tr')])
    request['conversationId'] = '123456789'
    request['price'] = str(order.subTotal)
    request['paidPrice'] = str(order.totalPrice)
    request['basketId'] = str(order.pk)
    request['paymentGroup'] = 'PRODUCT'
    request['callbackUrl'] = 'http://88.224.76.95:83/oxit/odeme-bildirim-iyzico/'
    request['installment'] = '4'

    address = dict([('address', order.address)])
    address['zipCode'] = '34732'

    address['city'] = order.city.name
    address['country'] = 'Turkey'
    request['shippingAddress'] = address
    request['billingAddress'] = address

    if order.isGuest:
        user = order.guestUser
        address['contactName'] = user.firstName + ' ' + user.lastName
        buyer = dict([('id', str(user.pk))])
        buyer['name'] = user.firstName
        buyer['surname'] = user.lastName
        buyer['gsmNumber'] = user.mobilePhone
        buyer['email'] = user.email
        buyer['identityNumber'] = '62535652352'
        buyer['lastLoginDate'] = '2020-03-18 18:03:24.86029+03'
        buyer['registrationDate'] = '2020-03-18 18:03:24.86029+03'
        buyer['registrationAddress'] = order.address
        buyer['ip'] = '85.34.78.112'
        buyer['city'] = order.city.name
        buyer['country'] = 'Turkey'
        buyer['zipCode'] = '34732'
    else:

        user = x.user
        profile = Profile.objects.get(user=user)
        address['contactName'] = user.first_name + ' ' + user.last_name

        buyer = dict([('id', str(user.pk))])
        buyer['name'] = user.first_name
        buyer['surname'] = user.last_name
        buyer['gsmNumber'] = profile.mobilePhone
        buyer['email'] = user.email
        buyer['identityNumber'] = '62535652352'
        buyer['lastLoginDate'] = str(user.last_login)
        buyer['registrationDate'] = str(user.date_joined)
        buyer['registrationAddress'] = order.address
        buyer['ip'] = '85.34.78.112'
        buyer['city'] = order.city.name
        buyer['country'] = 'Turkey'
        buyer['zipCode'] = '34732'
    request['buyer'] = buyer

    basket_items = []
    for product in order_products:
        basket_item = dict()
        basket_item['id'] = 'BI101'

        basket_item['name'] = product.product.name
        basket_item['category1'] = 'product.product.category.name'
        basket_item['itemType'] = 'PHYSICAL'
        basket_item['price'] = str(product.product.price * product.quantity)
        # basket_item['cargo'] = 'str(product.order.cargo.name)'

        basket_items.append(basket_item)

    request['basketItems'] = basket_items

    checkout_form_initialize = iyzipay.CheckoutFormInitialize()
    checkout_form_initialize_response = checkout_form_initialize.create(request, options)
    response = checkout_form_initialize_response.read().decode('utf-8')
    json_instance = json.loads(response)
    html = json_instance['checkoutFormContent'].replace('<script type="text/javascript">', '').replace(
        '</script>', '')
    token = json_instance['token']
    if IyzicoToken.objects.filter(order_id=order).count() == 0:
        order_token = IyzicoToken(token=token, order_id=order)
        order_token.save()
    request = x
    return render(x, 'checkout/kullanici-iyzico-odeme.html',
                  {'checkout_form': html, "card": order_products, "order": order})
def payment(request):
    context = dict()

    current_user = request.user
    order = Order.objects.filter(user__id=current_user.id).last()

    buyer = {
        'id': str(order.user.id),
        'name': str(order.first_name),
        'surname': str(order.last_name),
        'gsmNumber': str(order.phone),
        'email': str(order.email),
        'identityNumber': '11111111111',
        'lastLoginDate': '2015-10-05 12:43:35',
        'registrationDate': '2013-04-21 15:12:09',
        'registrationAddress': str(order.address),
        'ip': str(order.ip),
        'city': str(order.city),
        'country': 'Turkey',
        # 'zipCode': '34732'
    }

    address = {
        'contactName': str(order.first_name + " " + order.last_name),
        'city': str(order.city),
        'country': 'Turkey',
        'address': str(order.address),
        # 'zipCode': '34732'
    }

    basket_items = [
        {
            'id': str(order.id),
            'name': 'ThePALMZ Giyim',
            'category1': 'Kıyafet',
            'category2': 'Accessories',
            'itemType': 'PHYSICAL',
            'price': str(order.total),
        },
    ]

    request = {
        'locale': 'tr',
        'conversationId': str(order.code),
        'price': str(order.total),
        'paidPrice': str(order.total),
        'currency': 'TRY',
        'basketId': str(order.id),
        'paymentGroup': 'PRODUCT',
        "callbackUrl": "http://thepalmz.com/order/result/",
        "enabledInstallments": ['2', '3'],
        'buyer': buyer,
        'shippingAddress': address,
        'billingAddress': address,
        'basketItems': basket_items,
        # 'debitCardAllowed': True
    }

    checkout_form_initialize = iyzipay.CheckoutFormInitialize().create(
        request, options)

    # print(checkout_form_initialize.read().decode('utf-8'))
    page = checkout_form_initialize
    header = {'Content-Type': 'application/json'}
    content = checkout_form_initialize.read().decode('utf-8')
    json_content = json.loads(content)
    sozlukToken.append(json_content["token"])
    return HttpResponse(json_content["checkoutFormContent"])
Ejemplo n.º 7
0
def payment_with_form(request):
    options = {
        'api_key': settings.IYZIPAY_API_KEY,
        'secret_key': settings.IYZIPAY_API_SECRET,
        'base_url': settings.IYZIPAY_API_BASE_URL
    }

    buyer = {
        'id': 'BY789',
        'name': 'John',
        'surname': 'Doe',
        'gsmNumber': '+905350000000',
        'email': '*****@*****.**',
        'identityNumber': '74300864791',
        'lastLoginDate': '2015-10-05 12:43:35',
        'registrationDate': '2013-04-21 15:12:09',
        'registrationAddress': 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
        'ip': '85.34.78.112',
        'city': 'Istanbul',
        'country': 'Turkey',
        'zipCode': '34732'
    }

    address = {
        'contactName': 'Jane Doe',
        'city': 'Istanbul',
        'country': 'Turkey',
        'address': 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
        'zipCode': '34732'
    }

    basket_items = [
        {
            'id': 'BI101',
            'name': 'Binocular',
            'category1': 'Collectibles',
            'category2': 'Accessories',
            'itemType': 'PHYSICAL',
            'price': '25'
        }
    ]

    data = {
        'locale': 'tr',
        'conversationId': '123456789',
        'price': '25',
        'paidPrice': '25',
        'currency': 'TRY',
        'installment': '1',
        'basketId': 'B67832',
        'paymentGroup': 'PRODUCT',
        "callbackUrl": f"http://localhost:8000{reverse('success')}",
        'buyer': buyer,
        'shippingAddress': address,
        'billingAddress': address,
        'basketItems': basket_items,

    }

    checkout_form_initialize = iyzipay.CheckoutFormInitialize().create(data, options)
    result = checkout_form_initialize.read().decode('utf-8')
    print(result)
    result = json.loads(result)
    form = f"{result['checkoutFormContent']}"

    return render(request, 'payment_form_screen.html', context={'form': form})
Ejemplo n.º 8
0
def payment(request):
    context = dict()

    buyer = {
        'id': 'BY789',
        'name': 'John',
        'surname': 'Doe',
        'gsmNumber': '+905350000000',
        'email': '*****@*****.**',
        'identityNumber': '74300864791',
        'lastLoginDate': '2015-10-05 12:43:35',
        'registrationDate': '2013-04-21 15:12:09',
        'registrationAddress':
        'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
        'ip': '85.34.78.112',
        'city': 'Istanbul',
        'country': 'Turkey',
        'zipCode': '34732'
    }

    address = {
        'contactName': 'Jane Doe',
        'city': 'Istanbul',
        'country': 'Turkey',
        'address': 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
        'zipCode': '34732'
    }

    basket_items = [{
        'id': 'BI101',
        'name': 'Binocular',
        'category1': 'Collectibles',
        'category2': 'Accessories',
        'itemType': 'PHYSICAL',
        'price': '0.3'
    }, {
        'id': 'BI102',
        'name': 'Game code',
        'category1': 'Game',
        'category2': 'Online Game Items',
        'itemType': 'VIRTUAL',
        'price': '0.5'
    }, {
        'id': 'BI103',
        'name': 'Usb',
        'category1': 'Electronics',
        'category2': 'Usb / Cable',
        'itemType': 'PHYSICAL',
        'price': '0.2'
    }]

    request = {
        'locale': 'tr',
        'conversationId': '123456789',
        'price': '1',
        'paidPrice': '1.2',
        'currency': 'TRY',
        'basketId': 'B67832',
        'paymentGroup': 'PRODUCT',
        "callbackUrl": "http://localhost:8008/result/",
        "enabledInstallments": ['2', '3', '6', '9'],
        'buyer': buyer,
        'shippingAddress': address,
        'billingAddress': address,
        'basketItems': basket_items,
        # 'debitCardAllowed': True
    }

    checkout_form_initialize = iyzipay.CheckoutFormInitialize().create(
        request, options)

    #print(checkout_form_initialize.read().decode('utf-8'))
    page = checkout_form_initialize
    header = {'Content-Type': 'application/json'}
    content = checkout_form_initialize.read().decode('utf-8')
    json_content = json.loads(content)
    print(type(json_content))
    print(json_content["checkoutFormContent"])
    print("************************")
    print(json_content["token"])
    print("************************")
    sozlukToken.append(json_content["token"])
    return HttpResponse(json_content["checkoutFormContent"])
Ejemplo n.º 9
0
def pay(request):
    callbackUrl = 'http://' + str(
        get_current_site(request)) + '/payment/payment_result'
    request_iyzico = dict([('locale', 'tr')])
    request_iyzico['conversationId'] = '123456789'
    request_iyzico['price'] = '1'
    request_iyzico['paidPrice'] = '1.2'
    request_iyzico['basketId'] = 'B67832'
    request_iyzico['paymentGroup'] = 'PRODUCT'
    request_iyzico['callbackUrl'] = callbackUrl

    buyer = dict([('id', 'BY789')])
    buyer['name'] = 'John'
    buyer['surname'] = 'Doe'
    buyer['gsmNumber'] = '+905350000000'
    buyer['email'] = '*****@*****.**'
    buyer['identityNumber'] = '74300864791'
    buyer['lastLoginDate'] = '2015-10-05 12:43:35'
    buyer['registrationDate'] = '2013-04-21 15:12:09'
    buyer[
        'registrationAddress'] = 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1'
    buyer['ip'] = '85.34.78.112'
    buyer['city'] = 'Istanbul'
    buyer['country'] = 'Turkey'
    buyer['zipCode'] = '34732'
    request_iyzico['buyer'] = buyer

    address = dict([('address',
                     'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1')])
    address['zipCode'] = '34732'
    address['contactName'] = 'Jane Doe'
    address['city'] = 'Istanbul'
    address['country'] = 'Turkey'
    request_iyzico['shippingAddress'] = address
    request_iyzico['billingAddress'] = address

    basket_items = []
    basket_item_first = dict([('id', 'BI101')])
    basket_item_first['name'] = 'Binocular'
    basket_item_first['category1'] = 'Collectibles'
    basket_item_first['category2'] = 'Accessories'
    basket_item_first['itemType'] = 'PHYSICAL'
    basket_item_first['price'] = '0.3'
    # basket_item_first['subMerchantKey'] = 'sub merchant key'
    # basket_item_first['subMerchantPrice'] = '0.27'
    basket_items.append(basket_item_first)

    basket_item_second = dict([('id', 'BI102')])
    basket_item_second['name'] = 'Game code'
    basket_item_second['category1'] = 'Game'
    basket_item_second['category2'] = 'Online Game Items'
    basket_item_second['itemType'] = 'VIRTUAL'
    basket_item_second['price'] = '0.5'
    # basket_item_second['subMerchantKey'] = 'sub merchant key'
    # basket_item_second['subMerchantPrice'] = '0.42'
    basket_items.append(basket_item_second)

    basket_item_third = dict([('id', 'BI103')])
    basket_item_third['name'] = 'Usb'
    basket_item_third['category1'] = 'Electronics'
    basket_item_third['category2'] = 'Usb / Cable'
    basket_item_third['itemType'] = 'PHYSICAL'
    basket_item_third['price'] = '0.2'
    # basket_item_third['subMerchantKey'] = 'sub merchant key'
    # basket_item_third['subMerchantPrice'] = '0.18'
    basket_items.append(basket_item_third)

    request_iyzico['basketItems'] = basket_items

    checkout_form_initialize = iyzipay.CheckoutFormInitialize()
    checkout_form_initialize_response = checkout_form_initialize.create(
        request_iyzico, settings.IYZICO_OPTIONS)
    status_content = checkout_form_initialize_response.read().decode('utf-8')
    status_content = json.loads(status_content)
    print(status_content)
    # return HttpResponse(status_content['checkoutFormContent'])
    context = {'content': status_content}
    return render(request, 'pay.html', context)
Ejemplo n.º 10
0
def payment(request):
    context = dict()

    sepet = ShopCart.objects.all()
    odeme = list()
    for i in sepet:
        odeme.append(i.user)
        odeme.append(i.product)
        odeme.append(i.quantity * i.product.salePrice)
        print("------------", odeme)

    buyer = {
        'id': 'BY789',
        'name': 'John',
        'surname': 'Doe',
        'gsmNumber': '+905350000000',
        'email': '*****@*****.**',
        'identityNumber': '74300864791',
        'lastLoginDate': '2015-10-05 12:43:35',
        'registrationDate': '2013-04-21 15:12:09',
        'registrationAddress': 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
        'ip': '85.34.78.112',
        'city': 'Istanbul',
        'country': 'Turkey',
        'zipCode': '34732'
    }

    address = {
        'contactName': 'Jane Doe',
        'city': 'Istanbul',
        'country': 'Turkey',
        'address': 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
        'zipCode': '34732'
    }

    basket_items = [
        {
            'id': 'BI101',
            'name': 'Binocular',
            'category1': 'Collectibles',
            'category2': 'Accessories',
            'itemType': 'PHYSICAL',
            'price': '50.0'
        },

    ]


    # conversationId bunun için time modülü ile anlık değer üretiyorum. Yolluyorum.
    request = {
        'locale': 'tr',
        'conversationId': '123456789',
        'price': odeme[2],
        'paidPrice': odeme[2],
        'currency': 'TRY',
        'basketId': 'B67832',
        'paymentGroup': 'PRODUCT',
        "callbackUrl": "http://localhost:8007/orders/result/",
        "enabledInstallments": ['2', '3', '6', '9'],
        'buyer': buyer,
        'shippingAddress': address,
        'billingAddress': address,
        'basketItems': basket_items,
        #'debitCardAllowed': True
    }

    checkout_form_initialize = iyzipay.CheckoutFormInitialize().create(request, options)

    #print(checkout_form_initialize.read().decode('utf-8'))
    page = checkout_form_initialize
    header = {'Content-Type': 'application/json'}
    content = checkout_form_initialize.read().decode('utf-8')
    json_content = json.loads(content)
    print("------------------------")
    print(json_content)
    print("------------------------")
    print("gelen veri tipi", type(json_content))
    print("************************")
    print(json_content["token"])
    print("************************")
    sozlukToken.append(json_content["token"])
    return HttpResponse(json_content["checkoutFormContent"])