Skip to content

Commit

Permalink
update order models + webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
behshadrhp committed Nov 9, 2023
1 parent 60ce65e commit 700fd5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions order/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class Order(models.Model):
city = models.CharField(max_length=100)
paid = models.BooleanField(default=False)

# stripe webhooks id
stripe_id = models.CharField(max_length=250, blank=True)

# create & update fields
create_at = models.DateTimeField(auto_now_add=True)
update_at = models.DateField(auto_now=True)
Expand Down
2 changes: 2 additions & 0 deletions payment/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def stripe_webhooks(request):

# mark order as paid
order.paid = True
# store stripe payment IS
order.stripe_id = session.payment_intent
order.save()

return HttpResponse(status=200)

0 comments on commit 700fd5c

Please sign in to comment.