WAY 3 PayPal Server Side
+ Migrate is not needed – no changes to DB
– You need a client key not just the email
– Package must be installed
– PayPal app should be created in PayPal
1. Create sandbox account -for testing
2. Create business app in paypal
https://developer.paypal.com/developer
3. Install
pip install paypal-checkout-serversdk
4. Update settings
PAYPAL_CLIENT_ID = “client id here”
PAYPAL_SECRET_ID = “secret id here”
5. Get client id from server-side
learn/views.py
def pay(request, pk):
client_id = settings.PAYPAL_CLIENT_ID
course = get_object_or_404(Course, pk=pk)
return render(request, 'pay.html', {'course':course, 'client_id':client_id })