我使用Paypal与Django。这就是场景。 用户已登录,他尚未支付该服务的费用。付款后,我必须将其用户个人资料更新为“payed = True”。然后他就可以访问完整的网站了。
我很难理解这必须如何与paypal整合。我得到了付款成功。但是,当paypal向用户收费时,我的服务器如何知道它将会是什么用户?
我认为必须有一个字段让我发送到PayPal,就像用户ID一样,然后paypal必须在付款时发送给我,所以我可以看到它是哪个用户?
你如何用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")