本文整理汇总了Python中paypal.pro.helpers.PayPalWPP.getExpressCheckoutDetails方法的典型用法代码示例。如果您正苦于以下问题:Python PayPalWPP.getExpressCheckoutDetails方法的具体用法?Python PayPalWPP.getExpressCheckoutDetails怎么用?Python PayPalWPP.getExpressCheckoutDetails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paypal.pro.helpers.PayPalWPP
的用法示例。
在下文中一共展示了PayPalWPP.getExpressCheckoutDetails方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: paypal_end
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import getExpressCheckoutDetails [as 别名]
def paypal_end(request):
"""
Do payment and create order object in DB
"""
try:
wpp = PayPalWPP(request)
token = request.GET['token']
params = {"token": token}
nvp = wpp.getExpressCheckoutDetails(params)
order_dict = nvp.response_dict.copy()
params = {
"token": token,
"payerid": nvp.payerid,
"paymentrequest_0_amt": nvp.response_dict.get("paymentrequest_0_amt"),
"paymentrequest_0_currencycode" : nvp.response_dict.get("paymentrequest_0_currencycode")
}
payment = wpp.doExpressCheckoutPayment(params)
order_dict['transactionid'] = payment.response_dict.get('paymentinfo_0_transactionid')
order = create_order_from_express_paypal(order_dict)
send_order_email(order.email, order, order.items.all)
data = {
'order_id': order.id,
}
return HttpResponse(json.dumps(data), content_type='application/json')
except Exception, e:
print e
data = {
'error': e.message
}
return HttpResponseServerError(json.dumps(data), content_type='application/json')
示例2: paypal_confirm
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import getExpressCheckoutDetails [as 别名]
def paypal_confirm(request):
"""
Return from Paypal and create confirmation page
"""
wpp = PayPalWPP(request)
token = request.GET.get("token", "")
params = {"token": token}
nvp = wpp.getExpressCheckoutDetails(params)
"""
<QueryDict: {
u'l_paymentrequest_0_number1': [u'7'],
u'l_paymentrequest_0_number0': [u'6'],
u'shippingamt': [u'0.00'],
u'paymentrequest_0_shiptozip': [u'123456'],
u'paymentrequest_0_shiptostreet': [u'Pug str, 15'],
u'paymentrequest_0_shiptocountryname': [u'Russia'],
u'l_paymentrequest_0_taxamt1': [u'0.00'],
u'paymentrequest_0_shiptoname': [u'Second'],
u'shiptocountryname': [u'Russia'],
u'paymentrequestinfo_0_errorcode': [u'0'],
u'l_paymentrequest_0_taxamt0': [u'0.00'],
u'l_paymentrequest_0_amt1': [u'26.00'],
u'l_paymentrequest_0_amt0': [u'29.00'],
u'checkoutstatus': [u'PaymentActionNotInitiated'],
u'billingagreementacceptedstatus': [u'0'],
u'l_paymentrequest_0_name1': [u'Casual summer dress'],
u'l_paymentrequest_0_name0': [u'Vintage faux fur vest'],
u'l_taxamt0': [u'0.00'],
u'shipdiscamt': [u'0.00'],
u'paymentrequest_0_shipdiscamt': [u'0.00'],
u'paymentrequest_0_addressstatus': [u'Unconfirmed'],
u'lastname': [u'buyer'],
u'paymentrequest_0_shiptocity': [u'Moscow'],
u'correlationid': [u'ed7766d969878'],
u'addressstatus': [u'Unconfirmed'],
u'email': [u'[email protected]'],
u'build': [u'16751317'],
u'l_paymentrequest_0_qty1': [u'1'],
u'l_paymentrequest_0_qty0': [u'1'],
u'payerstatus': [u'verified'],
u'paymentrequest_0_insuranceamt': [u'0.00'],
u'firstname': [u'test'],
u'paymentrequest_0_currencycode': [u'USD'],
u'timestamp': [u'2015-05-22T15:34:54Z'],
u'currencycode': [u'USD'],
u'paymentrequest_0_amt': [u'55.00'],
u'paymentrequest_0_handlingamt': [u'0.00'],
u'insuranceamt': [u'0.00'],
u'handlingamt': [u'0.00'],
u'paymentrequest_0_insuranceoptionoffered': [u'false'],
u'l_taxamt1': [u'0.00'], u'amt': [u'55.00'],
u'paymentrequest_0_itemamt': [u'55.00'],
u'paymentrequest_0_shiptocountrycode': [u'RU'],
u'payerid': [u'3PMMXLXMPWBRC'],
u'ack': [u'Success'],
u'taxamt': [u'0.00'],
u'token': [u'EC-915576968K751545E'],
u'paymentrequest_0_taxamt': [u'0.00'],
u'itemamt': [u'55.00'],
u'paymentrequest_0_shippingamt': [u'0.00'],
"""
order = create_order_from_paypal_for_review(nvp)
response = HttpResponseRedirect("/#!/order/confirm")
response.set_cookie("order_type", "express")
response.set_cookie("order", json.dumps(order))
return response