|
27 | 27 | create_request = payjpv2.CustomerCreateRequest( |
28 | 28 | email="test@example.com", |
29 | 29 | description="Test customer from Python SDK", |
| 30 | + metadata={ |
| 31 | + "key1": payjpv2.MetadataValue("value1"), |
| 32 | + "key2": payjpv2.MetadataValue(123), |
| 33 | + "key3": payjpv2.MetadataValue(True), |
| 34 | + }, |
30 | 35 | ) |
31 | 36 |
|
32 | 37 | idempotency_key = str(uuid.uuid4()) |
|
38 | 43 | ) |
39 | 44 | customer_id = customer.id |
40 | 45 | print(f"Created customer: {customer_id}") |
41 | | - print(f"Email: {customer.email}\n") |
| 46 | + print(f"Email: {customer.email}") |
| 47 | + print(f"Metadata: {customer.metadata}\n") |
42 | 48 |
|
43 | 49 | # 2. Get Customer |
44 | 50 | print("=== 2. Get Customer ===") |
45 | 51 | retrieved = customers_api.get_customer(customer_id) |
46 | 52 | print(f"Retrieved customer: {retrieved.id}") |
47 | 53 | print(f"Email: {retrieved.email}") |
48 | | - print(f"Description: {retrieved.description or '(none)'}\n") |
| 54 | + print(f"Description: {retrieved.description or '(none)'}") |
| 55 | + print(f"Metadata: {retrieved.metadata}\n") |
49 | 56 |
|
50 | 57 | # 3. Update Customer |
51 | 58 | print("=== 3. Update Customer ===") |
52 | 59 | update_request = payjpv2.CustomerUpdateRequest( |
53 | 60 | description="Updated description from Python SDK", |
54 | 61 | email="updated@example.com", |
| 62 | + metadata={ |
| 63 | + "key1": payjpv2.MetadataValue("updated_value"), |
| 64 | + "key4": payjpv2.MetadataValue(456), |
| 65 | + }, |
55 | 66 | ) |
56 | 67 |
|
57 | 68 | updated = customers_api.update_customer(customer_id, update_request) |
58 | 69 | print(f"Updated customer: {updated.id}") |
59 | 70 | print(f"New email: {updated.email}") |
60 | | - print(f"New description: {updated.description or '(none)'}\n") |
| 71 | + print(f"New description: {updated.description or '(none)'}") |
| 72 | + print(f"Metadata: {updated.metadata}\n") |
61 | 73 |
|
62 | 74 | # 4. List Customers |
63 | 75 | print("=== 4. List Customers ===") |
|
0 commit comments