def offsite_braintree(request): fields = {"transaction": { "order_id": datetime.datetime.now().strftime("%Y%m%d%H%M%S"), "type": "sale", "options": { "submit_for_settlement": True }, }, "site": "%s://%s" % ("https" if request.is_secure() else "http", RequestSite(request).domain) } braintree_obj.add_fields(fields) template_vars = {'title': 'Braintree Payments Transparent Redirect', "bp_obj": braintree_obj} return render(request, "app/braintree_tr.html", template_vars)