mirror of
https://github.com/hubHarmony/servii-backend.git
synced 2024-11-17 21:40:31 +00:00
[+] Finances pre-0.9-alpha
This commit is contained in:
parent
1901711d97
commit
b4329614c1
28
finances.py
28
finances.py
@ -1,6 +1,5 @@
|
||||
from flask import Flask, request, jsonify
|
||||
import stripe
|
||||
import os
|
||||
from flask import Flask, request, jsonify
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@ -25,31 +24,18 @@ def webhook():
|
||||
return jsonify({'error': 'Invalid signature'}), 400
|
||||
|
||||
|
||||
print(event)
|
||||
# Handle the event based on its type
|
||||
match event['type']:
|
||||
case 'payment_intent.created':
|
||||
payment_intent = event['data']['object']
|
||||
print(f"PaymentIntent created: {payment_intent['id']}")
|
||||
case 'customer.created':
|
||||
customer = event['data']['object']
|
||||
print(f"Customer created: {customer['id']}")
|
||||
case 'payment_intent.succeeded':
|
||||
payment_intent = event['data']['object']
|
||||
print(f"PaymentIntent succeeded: {payment_intent['id']}")
|
||||
case 'charge.succeeded':
|
||||
charge = event['data']['object']
|
||||
print(f"Charge succeeded: {charge['id']}")
|
||||
case 'checkout.session.completed':
|
||||
session = event['data']['object']
|
||||
print(f"Checkout session completed: {session['id']}")
|
||||
case 'charge.failed':
|
||||
charge = event['data']['object']
|
||||
print(f"Charge failed: {charge['id']}")
|
||||
case 'customer.subscription.deleted':
|
||||
customer = event['data']['object']
|
||||
print(event)
|
||||
print(f"Customer stopped subscription: {customer['id']}")
|
||||
case 'customer.subscription.created':
|
||||
print(event)
|
||||
customer = event['data']['object']
|
||||
print(f"Customer started subscription: {customer['id']}")
|
||||
case 'customer.subscription.updated':
|
||||
print(event)
|
||||
customer = event['data']['object']
|
||||
print(f"Customer started subscription: {customer['id']}")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user