(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.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 |
*/* |