Signup or Login into Paypal Developers platform: https://developer.paypal.com/home/
Make sure you have selected Sandbox

Select Sandbox accounts

You should have two testing accounts by default. Both are eligible to make testing payments at the Oscar store.

Clicking the email will take you to a page with the account password

Django Oscar Paypal
Download the repository:
https://github.com/django-oscar/django-oscar-paypal
There is a folder paypal inside.
Copy folder paypal to our project folder root (mysite).
Your directories should look like this.
pip install paypalhttp
pip install paypal-checkout-serversdk
pip install django-localflavor
INSTALLED_APPS = [
...
'paypal',
]
PAYPAL_SANDBOX_MODE = True
PAYPAL_CALLBACK_HTTPS = False
PAYPAL_API_VERSION = '119'
PAYPAL_API_USERNAME = 'sdk-three_api1.sdk.com'
PAYPAL_API_PASSWORD = 'QFZCWN5HZM8VBG7Q'
PAYPAL_API_SIGNATURE = 'A-IzJhZZjhg29XQ2qnhapuwxIDzyAZQ92FRP5dqBzVesOkzbdUONzmOU'
urlpatterns = [
...
path('checkout/paypal/', include('paypal.express.urls')),
]
...
<li><a href="https://github.com/django-oscar/django-oscar-paypal">
{% if anon_checkout_allowed or request.user.is_authenticated %}
<a href="{% url 'paypal-redirect' %}">
<img src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" align="left" style="margin-right:7px;">
</a>
{% endif %}
</li>
...
Removing «Ship to» in paypal checkout window: (Optional)
class RedirectView(CheckoutSessionMixin, RedirectView):
...
as_payment_method = True
...
def _get_paypal_params(self):
"""
Return any additional PayPal parameters
"""
params = {}
params['NOSHIPPING'] = 1
return params
python manage.py makemigrations
python manage.py migrate
Next step is to change Paypal from sandbox to production and start accepting real payments.
Tested with: Django 5.2 Django-Oscar 4
04 May 2023
|
Last Updated: 02 Dec. 2025
|
jaimedcsilva Related