habulaj commited on
Commit
55d075c
·
verified ·
1 Parent(s): 7cf3f41

Update routes/hello.py

Browse files
Files changed (1) hide show
  1. routes/hello.py +21 -0
routes/hello.py CHANGED
@@ -12,6 +12,27 @@ class AccountRequest(BaseModel):
12
  email: str
13
  name: str # Name of the individual account owner
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  @router.post("/create_account")
16
  def create_account(account_data: AccountRequest):
17
  try:
 
12
  email: str
13
  name: str # Name of the individual account owner
14
 
15
+ class CreateCustomerRequest(BaseModel):
16
+ email: str
17
+ phone: str # Tel do usuário
18
+ name: str # Nome do usuário
19
+
20
+ @router.post("/create_customer")
21
+ def create_customer(data: CreateCustomerRequest):
22
+ try:
23
+ # Criar o cliente no Stripe com os dados fornecidos
24
+ customer = stripe.Customer.create(
25
+ email=data.email,
26
+ phone=data.phone,
27
+ name=data.name
28
+ )
29
+
30
+ # Retornar o ID do cliente (customer_id) criado
31
+ return {"customer_id": customer.id}
32
+
33
+ except Exception as e:
34
+ raise HTTPException(status_code=500, detail=f"Error creating customer: {str(e)}")
35
+
36
  @router.post("/create_account")
37
  def create_account(account_data: AccountRequest):
38
  try: