本文整理汇总了Python中paypal.standard.forms.PayPalPaymentsForm.use_sandbox方法的典型用法代码示例。如果您正苦于以下问题:Python PayPalPaymentsForm.use_sandbox方法的具体用法?Python PayPalPaymentsForm.use_sandbox怎么用?Python PayPalPaymentsForm.use_sandbox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paypal.standard.forms.PayPalPaymentsForm
的用法示例。
在下文中一共展示了PayPalPaymentsForm.use_sandbox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_paypal_form
# 需要导入模块: from paypal.standard.forms import PayPalPaymentsForm [as 别名]
# 或者: from paypal.standard.forms.PayPalPaymentsForm import use_sandbox [as 别名]
def create_paypal_form(order, return_page="unpaid_invoice"):
pp_settings = PayPalSettings.objects.all()
if pp_settings.count():
pp_settings = pp_settings[0]
else:
return None
domain = Site.objects.get_current().domain
paypal_dict = {
"business": pp_settings.business,
"amount": order.grand_total,
"item_name": " ".join(["Fifth Season order #", str(order.id)]),
"invoice": order.id,
"notify_url": "http://%s%s" % (domain, reverse("paypal-ipn")),
"return_url": "http://%s%s" % (domain, reverse(return_page, kwargs={"order_id": order.id})),
"cancel_return": "http://%s%s" % (domain, reverse(return_page, kwargs={"order_id": order.id})),
}
form = PayPalPaymentsForm(initial=paypal_dict)
form.use_sandbox = pp_settings.use_sandbox
return form