Не удается получить Django paypal IPN handshake

Я пытаюсь реализовать Django- PayPal в своем проекте, прошло уже 3 дня, я все еще застрял на этом, я не понимаю, как мы выполняем IPN handshake, Я получаю сигнал от PayPal после оплаты, но каков следующий шаг после этого, очень расстроен, нет четких документов об этом процессе, нужна помощь, заранее спасибо

def show_me_the_money(sender, **kwargs):
    ipn_obj = sender
    if ipn_obj.payment_status == ST_PP_COMPLETED:
      

        verify_url = settings.VERIFY_URL_TEST
        print ('content-type: text/plain')
        print ()
        print('SIgnal form paypal')

        param_str = sys.stdin.readline().strip()
        print(param_str)
        params = urllib.parse.parse_qsl(param_str)

        params.append(('cmd', '_notify-validate'))

        print(params)

        headers = {'content-type': 'application/x-www-form-urlencoded',
           'user-agent': 'Python-IPN-Verification-Script'}


        r = requests.post(verify_url, params=params, headers=headers, verify=True)
        r.raise_for_status()
        print(r)

        # WARNING !
        # Check that the receiver email is the same we previously
        # set on the `business` field. (The user could tamper with
        # that fields on the payment form before it goes to PayPal)

        if ipn_obj.receiver_email != settings.PAYPAL_RECEIVER_EMAIL:
        # Not a valid payment
            print('reciever mail is diff')
            print(ipn_obj.receiver_email)
            

        # ALSO: for the same reason, you need to check the amount
        # received, `custom` etc. are all what you expect or what
        # is allowed.

        # Undertake some action depending upon `ipn_obj`.
        if ipn_obj.custom == "premium_plan":
            price = ...
        else:
            price = ...

        if ipn_obj.mc_gross == price and ipn_obj.mc_currency == 'USD':
            ...
        else:
            pass
            #...
            



valid_ipn_received.connect(show_me_the_money)

Urls.py

path('payment/',PaymentProcess.as_view(),name='payment-process'),  
path('payment_redirect/',Payment.as_view(),name='payment-redirect'),  
path('createorder/',CreateOrderView.as_view(),name='create-order'),  
#  Paypal IPN url ------------------
path('notify_url/',notify_payment,name='paypal-ipn'),  
re_path(r'^paypal/', include('paypal.standard.ipn.urls')),
path('payment_done', payment_done,name='payment_done'),
Вернуться на верх