当前位置: 首页>>代码示例>>Python>>正文


Python PayPalWPP.setExpressCheckout方法代码示例

本文整理汇总了Python中paypal.pro.helpers.PayPalWPP.setExpressCheckout方法的典型用法代码示例。如果您正苦于以下问题:Python PayPalWPP.setExpressCheckout方法的具体用法?Python PayPalWPP.setExpressCheckout怎么用?Python PayPalWPP.setExpressCheckout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在paypal.pro.helpers.PayPalWPP的用法示例。


在下文中一共展示了PayPalWPP.setExpressCheckout方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: redirect_to_express

# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import setExpressCheckout [as 别名]
 def redirect_to_express(self):
     """
     First step of ExpressCheckout. Redirect the request to PayPal using the
     data returned from setExpressCheckout.
     """
     wpp = PayPalWPP(self.request)
     try:
         nvp_obj = wpp.setExpressCheckout(self.item)
     except PayPalFailure:
         self.context['errors'] = self.errors['paypal']
         return self.render_payment_form()
     else:
         return HttpResponseRedirect(express_endpoint_for_token(nvp_obj.token))
开发者ID:adamziel,项目名称:django-paypal,代码行数:15,代码来源:views.py

示例2: redirect_to_express

# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import setExpressCheckout [as 别名]
 def redirect_to_express(self):
     """
     First step of ExpressCheckout. Redirect the request to PayPal using the 
     data returned from setExpressCheckout.
     """
     wpp = PayPalWPP(self.request)
     nvp_obj = wpp.setExpressCheckout(self.item)
     if not nvp_obj.flag:
         pp_params = dict(token=nvp_obj.token, AMT=self.item['amt'], 
                          RETURNURL=self.item['returnurl'], 
                          CANCELURL=self.item['cancelurl'])
         pp_url = self.get_endpoint() % urlencode(pp_params)
         return HttpResponseRedirect(pp_url)
     else:
         self.context['errors'] = self.errors['paypal']
         return self.render_payment_form()
开发者ID:AnushPrem,项目名称:NewsBlur,代码行数:18,代码来源:views.py

示例3: redirect_to_express

# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import setExpressCheckout [as 别名]
 def redirect_to_express(self):
     """
     First express flow step.
     Redirect to PayPal with the data in tow.
     
     """
     wpp = PayPalWPP(self.request)
     nvp_obj = wpp.setExpressCheckout(self.item)
     if not nvp_obj.flag:
         pp_params = dict(token=nvp_obj.token, 
                          AMT=self.item['amt'], 
                          RETURNURL=self.item['returnurl'], 
                          CANCELURL=self.item['cancelurl'])
         pp_url = SANDBOX_EXPRESS_ENDPOINT % urllib.urlencode(pp_params)
         return HttpResponseRedirect(pp_url)
     else:
         self.context = {'errors':'There was a problem contacting PayPal. Please try again later.'}
         return self.render_payment_form()
开发者ID:ckelly,项目名称:django-paypal,代码行数:20,代码来源:views.py

示例4: redirect_to_express

# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import setExpressCheckout [as 别名]
 def redirect_to_express(self):
     """
     First step of ExpressCheckout. Redirect the request to PayPal using the 
     data returned from setExpressCheckout.
     """
     wpp = PayPalWPP(self.request)
     try:
         nvp_obj = wpp.setExpressCheckout(self.item)
     except PayPalFailure:
         self.context["errors"] = self.errors["paypal"]
         return self.render_payment_form()
     else:
         pp_params = dict(
             token=nvp_obj.token,
             AMT=self.item["amt"],
             RETURNURL=self.item["returnurl"],
             CANCELURL=self.item["cancelurl"],
         )
         pp_url = self.get_endpoint() % urlencode(pp_params)
         return HttpResponseRedirect(pp_url)
开发者ID:renefs87,项目名称:simple_shop_frontend,代码行数:22,代码来源:views.py

示例5: paypal_start

# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import setExpressCheckout [as 别名]
def paypal_start(request):
    """
    Creating express checkout request from users cart
    """
    try:
        params = get_cart_data_from_request(request)
        host_name = request.get_host()

        params.update({
            "returnurl": "http://" + host_name + "/order/paypal/confirm",
            "cancelurl": "http://" + host_name + "/#!/cart",
            "noshipping": 2,
        })

        wpp = PayPalWPP()
        nvp = wpp.setExpressCheckout(params)

        response = HttpResponseRedirect(settings.PAYPAL_URL + '/cgi-bin/webscr?cmd=_express-checkout&token=' + nvp.token)
        response.delete_cookie('cart')
        return response
    except Exception, e:
        #log error here
        print e
        return HttpResponseRedirect("/#!/cart")
开发者ID:maartenvantigkhem,项目名称:fomotv,代码行数:26,代码来源:views.py

示例6: redirect_to_express

# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import setExpressCheckout [as 别名]
    def redirect_to_express(self):
        """
        First step of ExpressCheckout. Redirect the request to PayPal using the
        data returned from setExpressCheckout.
        """
        wpp = PayPalWPP(self.request)
        try:
            nvp_obj = wpp.setExpressCheckout(self.item)
        except PayPalFailure:
            log.exception('paypal failure')
            self.context['errors'] = self.errors['paypal']
            return self.render_payment_form()
        else:
            pp_params = dict(token=nvp_obj.token,
                L_PAYMENTREQUEST_0_AMTm=self.item['PAYMENTREQUEST_0_AMT'],
                PAYMENTREQUEST_0_ITEMAMT=self.item['PAYMENTREQUEST_0_AMT'],
                PAYMENTREQUEST_0_AMT=self.item['PAYMENTREQUEST_0_AMT'],
                PAYMENTREQUEST_0_DESC=self.item['PAYMENTREQUEST_0_DESC'],
                PAYMENTREQUEST_0_CURRENCYCODE=self.item['PAYMENTREQUEST_0_CURRENCYCODE'],
                             RETURNURL=self.item['returnurl'],
                             CANCELURL=self.item['cancelurl'])
            pp_url = self.get_endpoint() % urlencode(pp_params)
#            log.info('redirect data: %s'% pp_url)
            return HttpResponseRedirect(pp_url)
开发者ID:evrenesat,项目名称:ganihomes,代码行数:26,代码来源:views.py


注:本文中的paypal.pro.helpers.PayPalWPP.setExpressCheckout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。