【发布时间】:2015-12-09 15:18:19
【问题描述】:
我在 Django 中使用 paypal。这就是场景。 用户已登录,他还没有为服务付费。付款后,我必须将他的用户资料更新为“已付款 = True”。然后他就可以访问整个网站。
我很难理解这必须如何与贝宝集成。我使付款成功。但是,当 paypal 向用户收费时,我的服务器如何知道它将是哪个用户呢?
我认为必须有一个字段供我发送到贝宝,例如用户 ID,然后贝宝在付款时必须将其发送给我,这样我才能看到它是哪个用户?
您如何使用 paypal 实现这一点?
创建按钮
paypal_dict = {
"cmd": "_xclick-subscriptions",
"business": settings.PAYPAL_RECEIVER_EMAIL,
"a3": "5.00", # monthly price
"p3": 1, # duration of each unit (depends on unit)
"t3": "M", # duration unit ("M for Month")
"src": "1", # make payments recur
"sra": "1", # reattempt payment on payment error
"no_note": "1", # remove extra notes (optional)
"item_name": "Test monthly subscription",
"notify_url": "http://localhost:8000/payment/",
"return_url": "http://localhost:8000/",
"cancel_return": "http://localhost:8000/",
"custom":request.user.get_profile().pk
}
# Create the instance.
ppform = PayPalPaymentsForm(initial=paypal_dict, button_type="subscribe")
【问题讨论】:
-
我可以按照以下步骤操作,我想如果我能做到这一点!!我很沮丧stackoverflow.com/questions/32551562/…
标签: django django-paypal