2012-01-13 60 views
1

我使用的Django meerchant为宝付款http://readthedocs.org/docs/django-merchant/en/latest/offsite/paypal.html ...如何将sanbox.paypal网站更改为django-merchant的paypal网站?

和我的看法有这样的代码:

      pay_pal = get_integration("pay_pal") 
          pay_pal.add_fields({ 
            "business": client.paypal_id, 
            "item_name": product.name, 
            "invoice": inst.trans_code, 
            "notify_url": settings.BASE_DNS + str(client.id) + '/book/'+str(inst.id) +'/success/?booksaved=1', 
            "return_url": settings.BASE_DNS + str(client.id) + '/book/'+str(inst.id) +'/success/?booksaved=1', 
            "cancel_return": settings.BASE_DNS + str(client.id) + '/?booksaved=0', 
            "amount": inst.book_charged}) 
          return render_to_response("pay_pay.html", {"obj": pay_pal, "product": product.name, "amount": inst.totalcost},context_instance=RequestContext(request)) 

我的模板pay_pay.html

{% extends "main_base_bookingpage.html" %} 
{% load billing_tags %} 

{% block content %} 
    Required Parameters from the view 
    <ul> 
     <li> item_name : {{ product }}</li> 
     <li> amount : {{ amount }}</li> 
    </ul> 
    {% paypal obj %} 
{% endblock %} 

我的问题是如何能我改变它,以便它会更改为贝宝网站,而不是sandbox.paypal网站?

在此先感谢...

回答

4

根据你既可以调用get_integrationpay_pal = get_integration("pay_pal", test_mode=False))时指定test_mode参数,或在设置文件中设置MERCHANT_TEST_MODE的文档。您也可能需要更改PAYPAL_TEST设置。

PS。我不与django-merchant合作,也不知道这是否会起作用,这只是文档中的假设。

+0

谢谢demalexx,我尝试你的答案'test_mode = False',它的工作原理。在我的代码中,在返回render_to_response(...)之前,我添加了:'pay_pal.test_mode = False' ... – gadss 2012-01-14 02:05:38