## in the view that renders the form import urllib user = request.user payment = Payment.objects.create(who=user,payment_system='Dineromail') return_url = urllib.quote('http://domain.com/return_url') #this where the user will return after finishing on Dineromail cancel_url = urllib.quote('http://domain.com/cancel_url') #if something go wrong dineromail_dict = {} i = 1 for payment in mypaymentmodel: #we add our items dineromail_dict['item_currency_'+str(i)] = 'mxn' #mexican pesos dineromail_dict['item_quantity_'+str(i)] = '1' #one of this type dineromail_dict['item_name_'+str(i)] = payment.thingtopay dineromail_dict['item_ammount_'+str(i)] = payment.price dineromail_dict['item_code_'+str(i)] = payment.id i += 1 #all these fields you can check in this pdf https://mx.dineromail.com/content/Integración-MX.pdf dineromail_dict['merchant'] = 1234578 dineromail_dict['NroItem'] = 'a unique string, unique per form 1323234wd' dineromail_dict['ok_url'] = return_url+'?dineromail=True&total=23' #Pass any parameters(not sensitive) so your site can use them to display a relevant page' dineromail_dict['error_url'] = cancel_url+'?dineromail=True&total=23' dineromail_dict['pending_url'] = return_url+'?dineromail=True&total=23' dineromail_dict['Mensaje'] = '0' #if you want the user to send us a message from dineromail dineromail_dict['header_image'] = 'http://domain.com/static/images/logo.png' #your logo dineromail_dict['payment_method_available'] = 'mx_oxxo;mx_7eleven' #see the pdf above dineromail_dict['country_id'] = '4' #reference in the pdf dineromail_dict['buyer_name'] = user.get_profile().first_name #your user data dineromail_dict['buyer_lastname'] = user.get_profile().last_name dineromail_dict['buyer_email'] = user.email dineromail_dict['buyer_phone'] = '555555555' dineromail_dict['change_quantity'] = '0' dineromail_dict['display_shipping'] = '0' dineromail_dict['button_color'] = 'ff8f1f' #hex values dineromail_dict['links_color'] = '000000' dineromail_dict['font_color'] = '000000' dineromail_dict['border_color'] = '000000' dineromail_dict['display_additional_charge'] = '0' context['dineromail'] = dineromail_dict return render_to_response(template_name,context,context_instance=RequestContext(request)) #### In your template