(customer_portal.customers)
Get authenticated customer.
Scopes: customer_portal:read customer_portal:write
import polar_sdk
from polar_sdk import Polar
with Polar() as polar:
res = polar.customer_portal.customers.get(security=polar_sdk.CustomerPortalCustomersGetSecurity(
customer_session="<YOUR_BEARER_TOKEN_HERE>",
))
# Handle response
print(res)
models.CustomerPortalCustomer
| Error Type | Status Code | Content Type |
|---|
| models.SDKError | 4XX, 5XX | */* |
Update authenticated customer.
import polar_sdk
from polar_sdk import Polar
with Polar() as polar:
res = polar.customer_portal.customers.update(security=polar_sdk.CustomerPortalCustomersUpdateSecurity(
customer_session="<YOUR_BEARER_TOKEN_HERE>",
), request={
"billing_address": {
"country": polar_sdk.AddressInputCountryAlpha2Input.US,
},
})
# Handle response
print(res)
models.CustomerPortalCustomer
| Error Type | Status Code | Content Type |
|---|
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Get saved payment methods of the authenticated customer.
import polar_sdk
from polar_sdk import Polar
with Polar() as polar:
res = polar.customer_portal.customers.list_payment_methods(security=polar_sdk.CustomerPortalCustomersListPaymentMethodsSecurity(
customer_session="<YOUR_BEARER_TOKEN_HERE>",
), page=1, limit=10)
while res is not None:
# Handle items
res = res.next()
models.CustomerPortalCustomersListPaymentMethodsResponse
| Error Type | Status Code | Content Type |
|---|
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Add a payment method to the authenticated customer.
import polar_sdk
from polar_sdk import Polar
with Polar() as polar:
res = polar.customer_portal.customers.add_payment_method(security=polar_sdk.CustomerPortalCustomersAddPaymentMethodSecurity(
customer_session="<YOUR_BEARER_TOKEN_HERE>",
), request={
"confirmation_token_id": "<id>",
"set_default": False,
"return_url": "https://yearly-custom.net/",
})
# Handle response
print(res)
models.CustomerPaymentMethodCreateResponse
| Error Type | Status Code | Content Type |
|---|
| models.PaymentMethodSetupFailed | 400 | application/json |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Confirm a payment method for the authenticated customer.
import polar_sdk
from polar_sdk import Polar
with Polar() as polar:
res = polar.customer_portal.customers.confirm_payment_method(security=polar_sdk.CustomerPortalCustomersConfirmPaymentMethodSecurity(
customer_session="<YOUR_BEARER_TOKEN_HERE>",
), request={
"setup_intent_id": "<id>",
"set_default": True,
})
# Handle response
print(res)
models.CustomerPaymentMethodCreateResponse
| Error Type | Status Code | Content Type |
|---|
| models.CustomerNotReady | 400 | application/json |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Delete a payment method from the authenticated customer.
import polar_sdk
from polar_sdk import Polar
with Polar() as polar:
polar.customer_portal.customers.delete_payment_method(security=polar_sdk.CustomerPortalCustomersDeletePaymentMethodSecurity(
customer_session="<YOUR_BEARER_TOKEN_HERE>",
), id="<id>")
# Use the SDK ...
| Error Type | Status Code | Content Type |
|---|
| models.PaymentMethodInUseByActiveSubscription | 400 | application/json |
| models.ResourceNotFound | 404 | application/json |
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Request an email change for the authenticated customer.
import polar_sdk
from polar_sdk import Polar
with Polar() as polar:
res = polar.customer_portal.customers.request_email_update(security=polar_sdk.CustomerPortalCustomersRequestEmailUpdateSecurity(
customer_session="<YOUR_BEARER_TOKEN_HERE>",
), request={
"email": "Tommie_Larkin78@gmail.com",
})
# Handle response
print(res)
Any
| Error Type | Status Code | Content Type |
|---|
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Check if an email change verification token is still valid.
from polar_sdk import Polar
with Polar() as polar:
polar.customer_portal.customers.check_email_update(token="<value>")
# Use the SDK ...
| Parameter | Type | Required | Description |
|---|
token | str | :heavy_check_mark: | N/A |
retries | Optional[utils.RetryConfig] | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
| Error Type | Status Code | Content Type |
|---|
| models.HTTPValidationError | 422 | application/json |
| models.SDKError | 4XX, 5XX | */* |
Verify an email change using the token from the verification email.
from polar_sdk import Polar
with Polar() as polar:
res = polar.customer_portal.customers.verify_email_update(request={
"token": "<value>",
})
# Handle response
print(res)
models.CustomerEmailUpdateVerifyResponse
| Error Type | Status Code | Content Type |
|---|
| models.SDKError | 4XX, 5XX | */* |