import json import stripe from typing import List, Dict, Union, Any from app import create_app, db from models import Payments, PaymentBatch, SinglePayments, PaymentPlans from splynx import Splynx, SPLYNX_URL, SPLYNX_KEY, SPLYNX_SECRET from services import log_activity from config import Config splynx = Splynx(url=SPLYNX_URL, key=SPLYNX_KEY, secret=SPLYNX_SECRET) api_key = Config.STRIPE_LIVE_API_KEY stripe.api_key = api_key if __name__ == "__main__": customers = stripe.Customer.search(query="email:'tom.bj@icloud.com'") print(customers) cust = splynx.Customer(31) print(f"cust: {json.dumps(cust,indent=2)}") params = { 'additional_attributes': { 'stripe_customer_id': customers['data'][-1]['id'] } } update_cust = splynx.put(url=f"/api/2.0/admin/customers/customer/31", params=params) print(f"update_cust: {update_cust}") cust = splynx.Customer(31) print(f"cust: {json.dumps(cust,indent=2)}") print(cust['additional_attributes']['stripe_customer_id'])