DEV Community

Discussion on: Integrate Stripe Payments with Django By Building a Digital Products Selling App

Collapse
 
gabi profile image
Gabriel • Edited

I have this code.

if event["type"]=="checkout.session.completed":

    session = event["data"]["object"]
    course_id = session["metadata"]["course_id"]


course = Course.objects.get(pk=course_id)

if request.user.is_authenticated:
     user = request.user
     purchase = Purchase(purshased_course=course,user=user)

      purchase.save()






Enter fullscreen mode Exit fullscreen mode

What do i need to fix the problem?