TransWikia.com

New page loading instead of the one I want while rendering in django

Stack Overflow Asked by VATSAL JAIN on February 7, 2021

This is my views.py:

def payment(request):
    if request.user.is_authenticated:
        customer=request.user.customer
        order, created=Order.objects.get_or_create(customer=customer, complete=False)
        items=order.orderitem_set.all()
        shippingddress=ShippingAddress.objects.filter(customer=customer)
    
        context={
            'items':items,
            'order':order,
            'ship':shippingddress
        }

        param_dict = {
                "requestType"   : "Payment",
                'MID': 'abcd',
           }
        param_dict['CHECKSUMHASH'] = Checksum.generate_checksum(param_dict, MERCHANT_KEY)
        return render(request, 'paytm.html', {'param_dict': param_dict,})

    return render(request,"payment.html",context)

and this is my urls.py:

path("payment/",views.payment,name="payment"),

Whenever I write localhost/payment instead of opening the payment html page it takes me to paytm.html(the action url):

<form action="https://securegw-stage.paytm.in/theia/api/v1/initiateTransaction?mid=TzoyBB65679567960126'&orderId='{{order.id}}'" method="post" name="paytm">
        
        {% for key,value in param_dict.items %}
    <input type="hidden" name="{{key}}" value="{{value}}">
    {% endfor %}
    </form>

What I want is that on opening localhost/payment it should open /payment page only and in that payment page when someone clicks on continue button then paytm.html should open but this is not working currently. Please help me.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP