本文整理匯總了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