django-paypal deprecation error : Use of the initial['return_url'] is Deprecated

62 Views Asked by At

I am trying to integrate django-paypal payment in my app but I keep getting this error even though I am using the latest version.

Please use initial['return'] instead""", DeprecationWarning)
DeprecationWarning: The use of the initial['return_url'] is Deprecated.
Please use initial['return'] instead

This happens after the call to PayPalPaymentsForm

form = PayPalPaymentsForm(initial=paypal_dict, button_type="subscribe") 

Is there any fix for this ?

1

There are 1 best solutions below

0
On

Just do what it says, change that return_url to just return.

You can reveal that from the related code:

def _fix_deprecated_return_url(self, initial_args):
    if 'return_url' in initial_args:
        warn("""The use of the initial['return_url'] is Deprecated.
                Please use initial['return'] instead""", DeprecationWarning)
        initial_args['return'] = initial_args['return_url']
        del initial_args['return_url']
    return initial_args