How to set Paypal redirect url in django oscar?

450 Views Asked by At

enter image description hereI got error while redirecting to local server through https request... i did't find any redirect paypal url settings to change the redirecting url to use http method .. how can i set paypal redircting url manually ?

a terminal error like this

"You're accessing the development server over HTTPS, but it only supports HTTP."

1

There are 1 best solutions below

0
On

This can be done by subclassing the original express RedirectView class and adding in your custom logic:

views.py

from paypal.express.views import RedirectView as OscarPaypalRedirectView

class RedirectView(OscarPaypalRedirectView):

    def _get_redirect_url(self, basket, **kwargs):
        return my_url

    def _get_paypal_params(self):
        """ Send extra paypal params """
        return {
            'SOLUTIONTYPE': 'Mark',
            'LANDINGPAGE': 'Login',
            'BRANDNAME': 'My Store',
        }

And then you can call this class in in your urls:

from .views import RedirectView, 

 urls = [
     ....
     ....
     url(r'paypal/redirect/', RedirectView.as_view(), name='paypal-redirect')
 ]