**I Want to integreted paytm payment integration but its occure error any one tell me how to solve this error ....................................................................................................... **
In below code return show above error ?
Checksum.py
def generate_refund_checksum(param_dict, merchant_key, salt=None):
for i in param_dict:
if("|" in param_dict[i]):
param_dict = {}
exit()
params_string = __get_param_string__(param_dict)
salt = salt if salt else __id_generator__(4)
final_string = '%s|%s' % (params_string, salt)
hasher = hashlib.sha256(final_string.encode())
hash_string = hasher.hexdigest()
hash_string += salt
return __encode__(hash_string, IV, merchant_key)
views.py
def checkout(request):
if request.method=="POST":
items_json = request.POST.get('itemsJson', '')
name = request.POST.get('name', '')
amount = request.POST.get('amount', '')
email = request.POST.get('email', '')
address = request.POST.get('address1', '') + " " + request.POST.get('address2', '')
city = request.POST.get('city', '')
state = request.POST.get('state', '')
zip_code = request.POST.get('zip_code', '')
phone = request.POST.get('phone', '')
order = Orders(items_json=items_json, name=name, email=email, address=address, city=city,
state=state, zip_code=zip_code, phone=phone, amount=amount)
order.save()
update = OrderUpdate(order_id=order.order_id, update_desc="The order has been placed")
update.save()
thank = True
id = order.order_id
# return render(request, 'shop/checkout.html', {'thank':thank, 'id': id})
# Request paytm to transfer the amount to your account after payment by user
param_dict = {
'MID': 'aLIuwT24854788821719',
'ORDER_ID': str(order.order_id),
'TXN_AMOUNT': str(amount),
'CUST_ID': email,
'INDUSTRY_TYPE_ID': 'Retail',
'WEBSITE': 'WEBSTAGING',
'CHANNEL_ID': 'WEB',
'CALLBACK_URL':'http://127.0.0.1:8000/shop/handlerequest/',
}
**param_dict['CHECKSUMHASH'] = Checksum.generate_checksum(param_dict,MERCHANT_KEY)**
return render(request, 'shop/paytm.html', {'param_dict': param_dict})
Show above error due to in views.py this line
param_dict['CHECKSUMHASH'] = Checksum.generate_checksum(param_dict,MERCHANT_KEY)
Finally i solved this above error by encoding see below I did in checksum.py file before solved