customが自分のカスタマイズ用のか?
何も入れないとDBには空っぽ。
@csrf_exempt def view_that_asks_for_money(request): # url = "http://47cc7e44.ngrok.com" url = "http://3ea2346f.ngrok.com" # What you want the button to do. paypal_dict = { "business": settings.PAYPAL_RECEIVER_EMAIL, "amount": "10.00", "item_name": "name of the item", "invoice": "unique-invoice-id23", "notify_url": url + reverse('paypal-ipn'), "return_url": url + reverse('return-location'), "cancel_return": url + reverse('return-location'), # for check by show_me_the_money later!!! "custom": request.user.id }
ここで設定しておけば出来るかもしれない。
customを使って、
@csrf_exempt def show_me_the_money(sender, **kwargs): ipn_obj = sender if ipn_obj.payment_status == ST_PP_COMPLETED: # ここで取るぜ! user_id = ipn_obj.custom p = PurchaseHistory(name=user_id, message='ST_PP_COMPLETED') p.save() valid_ipn_received.connect(show_me_the_money)