-
Notifications
You must be signed in to change notification settings - Fork 1
/
getlago_payment.py
48 lines (37 loc) · 1.04 KB
/
getlago_payment.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import os
import requests
from dotenv import load_dotenv
load_dotenv()
LAGO_API_KEY = os.getenv('LAGO_API_KEY')
LAGO_BASE_URL = "https://api.getlago.com"
def create_customer(customer_id, email, name):
"""
Create a customer in GetLago.
Args:
customer_id (str): The unique ID for the customer.
email (str): Customer's email.
name (str): Customer's name.
Returns:
dict: GetLago customer response.
"""
headers = {
"Authorization": f"Bearer {LAGO_API_KEY}",
"Content-Type": "application/json"
}
data = {
"customer": {
"external_id": customer_id,
"email": email,
"name": name
}
}
response = requests.post(f"{LAGO_BASE_URL}/v1/customers", json=data, headers=headers)
return response.json()
# Example usage
if __name__ == "__main__":
customer = create_customer(
"cust_1234",
"John Doe",
)
print(customer)