paid-python 0.5.0__py3-none-any.whl → 1.0.0a0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- paid/__init__.py +33 -0
- paid/client.py +1 -472
- paid/core/client_wrapper.py +3 -2
- paid/customers/__init__.py +3 -0
- paid/customers/client.py +428 -4
- paid/customers/raw_client.py +594 -2
- paid/customers/types/__init__.py +8 -0
- paid/customers/types/customers_check_entitlement_request_view.py +5 -0
- paid/customers/types/customers_check_entitlement_response.py +22 -0
- paid/orders/client.py +445 -0
- paid/orders/raw_client.py +705 -0
- paid/plans/client.py +142 -0
- paid/plans/raw_client.py +238 -0
- paid/types/__init__.py +30 -0
- paid/types/cancel_renewal_response.py +49 -0
- paid/types/contact_create_for_customer.py +37 -0
- paid/types/invoice.py +75 -0
- paid/types/invoice_status.py +5 -0
- paid/types/payment_method.py +58 -0
- paid/types/payment_method_card.py +49 -0
- paid/types/payment_method_type.py +5 -0
- paid/types/payment_method_us_bank_account.py +36 -0
- paid/types/payment_method_us_bank_account_account_type.py +5 -0
- paid/types/plan_group.py +60 -0
- paid/types/plan_plan_products_item.py +6 -0
- paid/types/plan_with_features.py +69 -0
- paid/types/plan_with_features_features_item.py +34 -0
- paid/types/proration_attribute_update.py +44 -0
- paid/types/proration_detail.py +49 -0
- paid/types/proration_upgrade_response.py +73 -0
- paid/types/signal_v_2.py +5 -5
- paid/usage/client.py +6 -6
- {paid_python-0.5.0.dist-info → paid_python-1.0.0a0.dist-info}/METADATA +6 -4
- {paid_python-0.5.0.dist-info → paid_python-1.0.0a0.dist-info}/RECORD +36 -36
- opentelemetry/instrumentation/openai/__init__.py +0 -54
- opentelemetry/instrumentation/openai/shared/__init__.py +0 -399
- opentelemetry/instrumentation/openai/shared/audio_wrappers.py +0 -247
- opentelemetry/instrumentation/openai/shared/chat_wrappers.py +0 -1192
- opentelemetry/instrumentation/openai/shared/completion_wrappers.py +0 -292
- opentelemetry/instrumentation/openai/shared/config.py +0 -15
- opentelemetry/instrumentation/openai/shared/embeddings_wrappers.py +0 -311
- opentelemetry/instrumentation/openai/shared/event_emitter.py +0 -108
- opentelemetry/instrumentation/openai/shared/event_models.py +0 -41
- opentelemetry/instrumentation/openai/shared/image_gen_wrappers.py +0 -68
- opentelemetry/instrumentation/openai/shared/span_utils.py +0 -0
- opentelemetry/instrumentation/openai/utils.py +0 -213
- opentelemetry/instrumentation/openai/v0/__init__.py +0 -176
- opentelemetry/instrumentation/openai/v1/__init__.py +0 -394
- opentelemetry/instrumentation/openai/v1/assistant_wrappers.py +0 -329
- opentelemetry/instrumentation/openai/v1/event_handler_wrapper.py +0 -134
- opentelemetry/instrumentation/openai/v1/responses_wrappers.py +0 -1113
- opentelemetry/instrumentation/openai/version.py +0 -1
- {paid_python-0.5.0.dist-info → paid_python-1.0.0a0.dist-info}/LICENSE +0 -0
- {paid_python-0.5.0.dist-info → paid_python-1.0.0a0.dist-info}/WHEEL +0 -0
paid/customers/client.py
CHANGED
|
@@ -6,13 +6,17 @@ import typing
|
|
|
6
6
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
7
7
|
from ..core.request_options import RequestOptions
|
|
8
8
|
from ..types.address import Address
|
|
9
|
+
from ..types.contact_create_for_customer import ContactCreateForCustomer
|
|
9
10
|
from ..types.cost_traces_response import CostTracesResponse
|
|
10
11
|
from ..types.creation_source import CreationSource
|
|
11
12
|
from ..types.customer import Customer
|
|
12
13
|
from ..types.entitlement_usage import EntitlementUsage
|
|
14
|
+
from ..types.payment_method import PaymentMethod
|
|
13
15
|
from ..types.tax_exempt_status import TaxExemptStatus
|
|
14
16
|
from ..types.usage_summaries_response import UsageSummariesResponse
|
|
15
17
|
from .raw_client import AsyncRawCustomersClient, RawCustomersClient
|
|
18
|
+
from .types.customers_check_entitlement_request_view import CustomersCheckEntitlementRequestView
|
|
19
|
+
from .types.customers_check_entitlement_response import CustomersCheckEntitlementResponse
|
|
16
20
|
|
|
17
21
|
# this is used as the default value for optional parameters
|
|
18
22
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -70,6 +74,7 @@ class CustomersClient:
|
|
|
70
74
|
website: typing.Optional[str] = OMIT,
|
|
71
75
|
billing_address: typing.Optional[Address] = OMIT,
|
|
72
76
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
77
|
+
contacts: typing.Optional[typing.Sequence[ContactCreateForCustomer]] = OMIT,
|
|
73
78
|
request_options: typing.Optional[RequestOptions] = None,
|
|
74
79
|
) -> Customer:
|
|
75
80
|
"""
|
|
@@ -96,17 +101,20 @@ class CustomersClient:
|
|
|
96
101
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
97
102
|
Flexible JSON field for storing custom metadata about the customer
|
|
98
103
|
|
|
104
|
+
contacts : typing.Optional[typing.Sequence[ContactCreateForCustomer]]
|
|
105
|
+
Array of contacts to create for this customer
|
|
106
|
+
|
|
99
107
|
request_options : typing.Optional[RequestOptions]
|
|
100
108
|
Request-specific configuration.
|
|
101
109
|
|
|
102
110
|
Returns
|
|
103
111
|
-------
|
|
104
112
|
Customer
|
|
105
|
-
Success response
|
|
113
|
+
Success response - customer already exists with this externalId
|
|
106
114
|
|
|
107
115
|
Examples
|
|
108
116
|
--------
|
|
109
|
-
from paid import Paid
|
|
117
|
+
from paid import ContactCreateForCustomer, Paid
|
|
110
118
|
|
|
111
119
|
client = Paid(
|
|
112
120
|
token="YOUR_TOKEN",
|
|
@@ -114,6 +122,21 @@ class CustomersClient:
|
|
|
114
122
|
client.customers.create(
|
|
115
123
|
name="Acme, Inc.",
|
|
116
124
|
external_id="acme-inc",
|
|
125
|
+
contacts=[
|
|
126
|
+
ContactCreateForCustomer(
|
|
127
|
+
salutation="Mr.",
|
|
128
|
+
first_name="John",
|
|
129
|
+
last_name="Doe",
|
|
130
|
+
account_name="Acme, Inc.",
|
|
131
|
+
email="john.doe@acme.com",
|
|
132
|
+
phone="+1-555-0100",
|
|
133
|
+
billing_street="123 Main Street",
|
|
134
|
+
billing_city="San Francisco",
|
|
135
|
+
billing_state_province="CA",
|
|
136
|
+
billing_country="USA",
|
|
137
|
+
billing_postal_code="94102",
|
|
138
|
+
)
|
|
139
|
+
],
|
|
117
140
|
)
|
|
118
141
|
"""
|
|
119
142
|
_response = self._raw_client.create(
|
|
@@ -127,6 +150,7 @@ class CustomersClient:
|
|
|
127
150
|
website=website,
|
|
128
151
|
billing_address=billing_address,
|
|
129
152
|
metadata=metadata,
|
|
153
|
+
contacts=contacts,
|
|
130
154
|
request_options=request_options,
|
|
131
155
|
)
|
|
132
156
|
return _response.data
|
|
@@ -267,6 +291,52 @@ class CustomersClient:
|
|
|
267
291
|
_response = self._raw_client.delete(customer_id, request_options=request_options)
|
|
268
292
|
return _response.data
|
|
269
293
|
|
|
294
|
+
def check_entitlement(
|
|
295
|
+
self,
|
|
296
|
+
customer_id: str,
|
|
297
|
+
*,
|
|
298
|
+
event_name: str,
|
|
299
|
+
view: typing.Optional[CustomersCheckEntitlementRequestView] = None,
|
|
300
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
301
|
+
) -> CustomersCheckEntitlementResponse:
|
|
302
|
+
"""
|
|
303
|
+
Parameters
|
|
304
|
+
----------
|
|
305
|
+
customer_id : str
|
|
306
|
+
The customer ID
|
|
307
|
+
|
|
308
|
+
event_name : str
|
|
309
|
+
The name of the usage event to check entitlement for
|
|
310
|
+
|
|
311
|
+
view : typing.Optional[CustomersCheckEntitlementRequestView]
|
|
312
|
+
Filter view - 'all' returns all entitlements regardless of status, 'active_only' returns only currently active entitlements with available credits
|
|
313
|
+
|
|
314
|
+
request_options : typing.Optional[RequestOptions]
|
|
315
|
+
Request-specific configuration.
|
|
316
|
+
|
|
317
|
+
Returns
|
|
318
|
+
-------
|
|
319
|
+
CustomersCheckEntitlementResponse
|
|
320
|
+
Success response
|
|
321
|
+
|
|
322
|
+
Examples
|
|
323
|
+
--------
|
|
324
|
+
from paid import Paid
|
|
325
|
+
|
|
326
|
+
client = Paid(
|
|
327
|
+
token="YOUR_TOKEN",
|
|
328
|
+
)
|
|
329
|
+
client.customers.check_entitlement(
|
|
330
|
+
customer_id="customerId",
|
|
331
|
+
event_name="event_name",
|
|
332
|
+
view="all",
|
|
333
|
+
)
|
|
334
|
+
"""
|
|
335
|
+
_response = self._raw_client.check_entitlement(
|
|
336
|
+
customer_id, event_name=event_name, view=view, request_options=request_options
|
|
337
|
+
)
|
|
338
|
+
return _response.data
|
|
339
|
+
|
|
270
340
|
def get_entitlements(
|
|
271
341
|
self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
272
342
|
) -> typing.List[EntitlementUsage]:
|
|
@@ -568,6 +638,134 @@ class CustomersClient:
|
|
|
568
638
|
)
|
|
569
639
|
return _response.data
|
|
570
640
|
|
|
641
|
+
def list_payment_methods(
|
|
642
|
+
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
643
|
+
) -> typing.List[PaymentMethod]:
|
|
644
|
+
"""
|
|
645
|
+
Retrieves all payment methods associated with a customer identified by their external ID.
|
|
646
|
+
|
|
647
|
+
Parameters
|
|
648
|
+
----------
|
|
649
|
+
external_id : str
|
|
650
|
+
The external ID of the customer
|
|
651
|
+
|
|
652
|
+
request_options : typing.Optional[RequestOptions]
|
|
653
|
+
Request-specific configuration.
|
|
654
|
+
|
|
655
|
+
Returns
|
|
656
|
+
-------
|
|
657
|
+
typing.List[PaymentMethod]
|
|
658
|
+
Success response
|
|
659
|
+
|
|
660
|
+
Examples
|
|
661
|
+
--------
|
|
662
|
+
from paid import Paid
|
|
663
|
+
|
|
664
|
+
client = Paid(
|
|
665
|
+
token="YOUR_TOKEN",
|
|
666
|
+
)
|
|
667
|
+
client.customers.list_payment_methods(
|
|
668
|
+
external_id="externalId",
|
|
669
|
+
)
|
|
670
|
+
"""
|
|
671
|
+
_response = self._raw_client.list_payment_methods(external_id, request_options=request_options)
|
|
672
|
+
return _response.data
|
|
673
|
+
|
|
674
|
+
def create_payment_method(
|
|
675
|
+
self,
|
|
676
|
+
external_id: str,
|
|
677
|
+
*,
|
|
678
|
+
confirmation_token: str,
|
|
679
|
+
return_url: str,
|
|
680
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
681
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
682
|
+
) -> PaymentMethod:
|
|
683
|
+
"""
|
|
684
|
+
Creates a new payment method for a customer using a Stripe confirmation token.
|
|
685
|
+
|
|
686
|
+
Parameters
|
|
687
|
+
----------
|
|
688
|
+
external_id : str
|
|
689
|
+
The external ID of the customer
|
|
690
|
+
|
|
691
|
+
confirmation_token : str
|
|
692
|
+
Stripe confirmation token for the payment method
|
|
693
|
+
|
|
694
|
+
return_url : str
|
|
695
|
+
URL to redirect to after payment method setup
|
|
696
|
+
|
|
697
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
698
|
+
Optional metadata to attach to the payment method
|
|
699
|
+
|
|
700
|
+
request_options : typing.Optional[RequestOptions]
|
|
701
|
+
Request-specific configuration.
|
|
702
|
+
|
|
703
|
+
Returns
|
|
704
|
+
-------
|
|
705
|
+
PaymentMethod
|
|
706
|
+
Payment method created successfully
|
|
707
|
+
|
|
708
|
+
Examples
|
|
709
|
+
--------
|
|
710
|
+
from paid import Paid
|
|
711
|
+
|
|
712
|
+
client = Paid(
|
|
713
|
+
token="YOUR_TOKEN",
|
|
714
|
+
)
|
|
715
|
+
client.customers.create_payment_method(
|
|
716
|
+
external_id="externalId",
|
|
717
|
+
confirmation_token="ctoken_1234567890",
|
|
718
|
+
return_url="https://example.com/payment-method-added",
|
|
719
|
+
metadata={"source": "api"},
|
|
720
|
+
)
|
|
721
|
+
"""
|
|
722
|
+
_response = self._raw_client.create_payment_method(
|
|
723
|
+
external_id,
|
|
724
|
+
confirmation_token=confirmation_token,
|
|
725
|
+
return_url=return_url,
|
|
726
|
+
metadata=metadata,
|
|
727
|
+
request_options=request_options,
|
|
728
|
+
)
|
|
729
|
+
return _response.data
|
|
730
|
+
|
|
731
|
+
def delete_payment_method(
|
|
732
|
+
self, external_id: str, payment_method_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
733
|
+
) -> None:
|
|
734
|
+
"""
|
|
735
|
+
Deletes a specific payment method from a customer's account.
|
|
736
|
+
|
|
737
|
+
Parameters
|
|
738
|
+
----------
|
|
739
|
+
external_id : str
|
|
740
|
+
The external ID of the customer
|
|
741
|
+
|
|
742
|
+
payment_method_id : str
|
|
743
|
+
The ID of the payment method to delete
|
|
744
|
+
|
|
745
|
+
request_options : typing.Optional[RequestOptions]
|
|
746
|
+
Request-specific configuration.
|
|
747
|
+
|
|
748
|
+
Returns
|
|
749
|
+
-------
|
|
750
|
+
None
|
|
751
|
+
|
|
752
|
+
Examples
|
|
753
|
+
--------
|
|
754
|
+
from paid import Paid
|
|
755
|
+
|
|
756
|
+
client = Paid(
|
|
757
|
+
token="YOUR_TOKEN",
|
|
758
|
+
)
|
|
759
|
+
client.customers.delete_payment_method(
|
|
760
|
+
external_id="externalId",
|
|
761
|
+
payment_method_id="paymentMethodId",
|
|
762
|
+
)
|
|
763
|
+
"""
|
|
764
|
+
_response = self._raw_client.delete_payment_method(
|
|
765
|
+
external_id, payment_method_id, request_options=request_options
|
|
766
|
+
)
|
|
767
|
+
return _response.data
|
|
768
|
+
|
|
571
769
|
|
|
572
770
|
class AsyncCustomersClient:
|
|
573
771
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -629,6 +827,7 @@ class AsyncCustomersClient:
|
|
|
629
827
|
website: typing.Optional[str] = OMIT,
|
|
630
828
|
billing_address: typing.Optional[Address] = OMIT,
|
|
631
829
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
830
|
+
contacts: typing.Optional[typing.Sequence[ContactCreateForCustomer]] = OMIT,
|
|
632
831
|
request_options: typing.Optional[RequestOptions] = None,
|
|
633
832
|
) -> Customer:
|
|
634
833
|
"""
|
|
@@ -655,19 +854,22 @@ class AsyncCustomersClient:
|
|
|
655
854
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
656
855
|
Flexible JSON field for storing custom metadata about the customer
|
|
657
856
|
|
|
857
|
+
contacts : typing.Optional[typing.Sequence[ContactCreateForCustomer]]
|
|
858
|
+
Array of contacts to create for this customer
|
|
859
|
+
|
|
658
860
|
request_options : typing.Optional[RequestOptions]
|
|
659
861
|
Request-specific configuration.
|
|
660
862
|
|
|
661
863
|
Returns
|
|
662
864
|
-------
|
|
663
865
|
Customer
|
|
664
|
-
Success response
|
|
866
|
+
Success response - customer already exists with this externalId
|
|
665
867
|
|
|
666
868
|
Examples
|
|
667
869
|
--------
|
|
668
870
|
import asyncio
|
|
669
871
|
|
|
670
|
-
from paid import AsyncPaid
|
|
872
|
+
from paid import AsyncPaid, ContactCreateForCustomer
|
|
671
873
|
|
|
672
874
|
client = AsyncPaid(
|
|
673
875
|
token="YOUR_TOKEN",
|
|
@@ -678,6 +880,21 @@ class AsyncCustomersClient:
|
|
|
678
880
|
await client.customers.create(
|
|
679
881
|
name="Acme, Inc.",
|
|
680
882
|
external_id="acme-inc",
|
|
883
|
+
contacts=[
|
|
884
|
+
ContactCreateForCustomer(
|
|
885
|
+
salutation="Mr.",
|
|
886
|
+
first_name="John",
|
|
887
|
+
last_name="Doe",
|
|
888
|
+
account_name="Acme, Inc.",
|
|
889
|
+
email="john.doe@acme.com",
|
|
890
|
+
phone="+1-555-0100",
|
|
891
|
+
billing_street="123 Main Street",
|
|
892
|
+
billing_city="San Francisco",
|
|
893
|
+
billing_state_province="CA",
|
|
894
|
+
billing_country="USA",
|
|
895
|
+
billing_postal_code="94102",
|
|
896
|
+
)
|
|
897
|
+
],
|
|
681
898
|
)
|
|
682
899
|
|
|
683
900
|
|
|
@@ -694,6 +911,7 @@ class AsyncCustomersClient:
|
|
|
694
911
|
website=website,
|
|
695
912
|
billing_address=billing_address,
|
|
696
913
|
metadata=metadata,
|
|
914
|
+
contacts=contacts,
|
|
697
915
|
request_options=request_options,
|
|
698
916
|
)
|
|
699
917
|
return _response.data
|
|
@@ -858,6 +1076,60 @@ class AsyncCustomersClient:
|
|
|
858
1076
|
_response = await self._raw_client.delete(customer_id, request_options=request_options)
|
|
859
1077
|
return _response.data
|
|
860
1078
|
|
|
1079
|
+
async def check_entitlement(
|
|
1080
|
+
self,
|
|
1081
|
+
customer_id: str,
|
|
1082
|
+
*,
|
|
1083
|
+
event_name: str,
|
|
1084
|
+
view: typing.Optional[CustomersCheckEntitlementRequestView] = None,
|
|
1085
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1086
|
+
) -> CustomersCheckEntitlementResponse:
|
|
1087
|
+
"""
|
|
1088
|
+
Parameters
|
|
1089
|
+
----------
|
|
1090
|
+
customer_id : str
|
|
1091
|
+
The customer ID
|
|
1092
|
+
|
|
1093
|
+
event_name : str
|
|
1094
|
+
The name of the usage event to check entitlement for
|
|
1095
|
+
|
|
1096
|
+
view : typing.Optional[CustomersCheckEntitlementRequestView]
|
|
1097
|
+
Filter view - 'all' returns all entitlements regardless of status, 'active_only' returns only currently active entitlements with available credits
|
|
1098
|
+
|
|
1099
|
+
request_options : typing.Optional[RequestOptions]
|
|
1100
|
+
Request-specific configuration.
|
|
1101
|
+
|
|
1102
|
+
Returns
|
|
1103
|
+
-------
|
|
1104
|
+
CustomersCheckEntitlementResponse
|
|
1105
|
+
Success response
|
|
1106
|
+
|
|
1107
|
+
Examples
|
|
1108
|
+
--------
|
|
1109
|
+
import asyncio
|
|
1110
|
+
|
|
1111
|
+
from paid import AsyncPaid
|
|
1112
|
+
|
|
1113
|
+
client = AsyncPaid(
|
|
1114
|
+
token="YOUR_TOKEN",
|
|
1115
|
+
)
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
async def main() -> None:
|
|
1119
|
+
await client.customers.check_entitlement(
|
|
1120
|
+
customer_id="customerId",
|
|
1121
|
+
event_name="event_name",
|
|
1122
|
+
view="all",
|
|
1123
|
+
)
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
asyncio.run(main())
|
|
1127
|
+
"""
|
|
1128
|
+
_response = await self._raw_client.check_entitlement(
|
|
1129
|
+
customer_id, event_name=event_name, view=view, request_options=request_options
|
|
1130
|
+
)
|
|
1131
|
+
return _response.data
|
|
1132
|
+
|
|
861
1133
|
async def get_entitlements(
|
|
862
1134
|
self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
863
1135
|
) -> typing.List[EntitlementUsage]:
|
|
@@ -1204,3 +1476,155 @@ class AsyncCustomersClient:
|
|
|
1204
1476
|
request_options=request_options,
|
|
1205
1477
|
)
|
|
1206
1478
|
return _response.data
|
|
1479
|
+
|
|
1480
|
+
async def list_payment_methods(
|
|
1481
|
+
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1482
|
+
) -> typing.List[PaymentMethod]:
|
|
1483
|
+
"""
|
|
1484
|
+
Retrieves all payment methods associated with a customer identified by their external ID.
|
|
1485
|
+
|
|
1486
|
+
Parameters
|
|
1487
|
+
----------
|
|
1488
|
+
external_id : str
|
|
1489
|
+
The external ID of the customer
|
|
1490
|
+
|
|
1491
|
+
request_options : typing.Optional[RequestOptions]
|
|
1492
|
+
Request-specific configuration.
|
|
1493
|
+
|
|
1494
|
+
Returns
|
|
1495
|
+
-------
|
|
1496
|
+
typing.List[PaymentMethod]
|
|
1497
|
+
Success response
|
|
1498
|
+
|
|
1499
|
+
Examples
|
|
1500
|
+
--------
|
|
1501
|
+
import asyncio
|
|
1502
|
+
|
|
1503
|
+
from paid import AsyncPaid
|
|
1504
|
+
|
|
1505
|
+
client = AsyncPaid(
|
|
1506
|
+
token="YOUR_TOKEN",
|
|
1507
|
+
)
|
|
1508
|
+
|
|
1509
|
+
|
|
1510
|
+
async def main() -> None:
|
|
1511
|
+
await client.customers.list_payment_methods(
|
|
1512
|
+
external_id="externalId",
|
|
1513
|
+
)
|
|
1514
|
+
|
|
1515
|
+
|
|
1516
|
+
asyncio.run(main())
|
|
1517
|
+
"""
|
|
1518
|
+
_response = await self._raw_client.list_payment_methods(external_id, request_options=request_options)
|
|
1519
|
+
return _response.data
|
|
1520
|
+
|
|
1521
|
+
async def create_payment_method(
|
|
1522
|
+
self,
|
|
1523
|
+
external_id: str,
|
|
1524
|
+
*,
|
|
1525
|
+
confirmation_token: str,
|
|
1526
|
+
return_url: str,
|
|
1527
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
1528
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1529
|
+
) -> PaymentMethod:
|
|
1530
|
+
"""
|
|
1531
|
+
Creates a new payment method for a customer using a Stripe confirmation token.
|
|
1532
|
+
|
|
1533
|
+
Parameters
|
|
1534
|
+
----------
|
|
1535
|
+
external_id : str
|
|
1536
|
+
The external ID of the customer
|
|
1537
|
+
|
|
1538
|
+
confirmation_token : str
|
|
1539
|
+
Stripe confirmation token for the payment method
|
|
1540
|
+
|
|
1541
|
+
return_url : str
|
|
1542
|
+
URL to redirect to after payment method setup
|
|
1543
|
+
|
|
1544
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1545
|
+
Optional metadata to attach to the payment method
|
|
1546
|
+
|
|
1547
|
+
request_options : typing.Optional[RequestOptions]
|
|
1548
|
+
Request-specific configuration.
|
|
1549
|
+
|
|
1550
|
+
Returns
|
|
1551
|
+
-------
|
|
1552
|
+
PaymentMethod
|
|
1553
|
+
Payment method created successfully
|
|
1554
|
+
|
|
1555
|
+
Examples
|
|
1556
|
+
--------
|
|
1557
|
+
import asyncio
|
|
1558
|
+
|
|
1559
|
+
from paid import AsyncPaid
|
|
1560
|
+
|
|
1561
|
+
client = AsyncPaid(
|
|
1562
|
+
token="YOUR_TOKEN",
|
|
1563
|
+
)
|
|
1564
|
+
|
|
1565
|
+
|
|
1566
|
+
async def main() -> None:
|
|
1567
|
+
await client.customers.create_payment_method(
|
|
1568
|
+
external_id="externalId",
|
|
1569
|
+
confirmation_token="ctoken_1234567890",
|
|
1570
|
+
return_url="https://example.com/payment-method-added",
|
|
1571
|
+
metadata={"source": "api"},
|
|
1572
|
+
)
|
|
1573
|
+
|
|
1574
|
+
|
|
1575
|
+
asyncio.run(main())
|
|
1576
|
+
"""
|
|
1577
|
+
_response = await self._raw_client.create_payment_method(
|
|
1578
|
+
external_id,
|
|
1579
|
+
confirmation_token=confirmation_token,
|
|
1580
|
+
return_url=return_url,
|
|
1581
|
+
metadata=metadata,
|
|
1582
|
+
request_options=request_options,
|
|
1583
|
+
)
|
|
1584
|
+
return _response.data
|
|
1585
|
+
|
|
1586
|
+
async def delete_payment_method(
|
|
1587
|
+
self, external_id: str, payment_method_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1588
|
+
) -> None:
|
|
1589
|
+
"""
|
|
1590
|
+
Deletes a specific payment method from a customer's account.
|
|
1591
|
+
|
|
1592
|
+
Parameters
|
|
1593
|
+
----------
|
|
1594
|
+
external_id : str
|
|
1595
|
+
The external ID of the customer
|
|
1596
|
+
|
|
1597
|
+
payment_method_id : str
|
|
1598
|
+
The ID of the payment method to delete
|
|
1599
|
+
|
|
1600
|
+
request_options : typing.Optional[RequestOptions]
|
|
1601
|
+
Request-specific configuration.
|
|
1602
|
+
|
|
1603
|
+
Returns
|
|
1604
|
+
-------
|
|
1605
|
+
None
|
|
1606
|
+
|
|
1607
|
+
Examples
|
|
1608
|
+
--------
|
|
1609
|
+
import asyncio
|
|
1610
|
+
|
|
1611
|
+
from paid import AsyncPaid
|
|
1612
|
+
|
|
1613
|
+
client = AsyncPaid(
|
|
1614
|
+
token="YOUR_TOKEN",
|
|
1615
|
+
)
|
|
1616
|
+
|
|
1617
|
+
|
|
1618
|
+
async def main() -> None:
|
|
1619
|
+
await client.customers.delete_payment_method(
|
|
1620
|
+
external_id="externalId",
|
|
1621
|
+
payment_method_id="paymentMethodId",
|
|
1622
|
+
)
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
asyncio.run(main())
|
|
1626
|
+
"""
|
|
1627
|
+
_response = await self._raw_client.delete_payment_method(
|
|
1628
|
+
external_id, payment_method_id, request_options=request_options
|
|
1629
|
+
)
|
|
1630
|
+
return _response.data
|