PolarCustomers

June 8, 2026 ยท View on GitHub

(customer_portal.customers)

Overview

Available Operations

get

Get authenticated customer.

Scopes: customer_portal:read customer_portal:write

Example Usage

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)

Parameters

ParameterTypeRequiredDescription
securitymodels.CustomerPortalCustomersGetSecurity:heavy_check_mark:The security requirements to use for the request.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.CustomerPortalCustomer

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*

update

Update authenticated customer.

Example Usage

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)

Parameters

ParameterTypeRequiredDescription
requestmodels.CustomerPortalCustomerUpdate:heavy_check_mark:The request object to use for the request.
securitymodels.CustomerPortalCustomersUpdateSecurity:heavy_check_mark:The security requirements to use for the request.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.CustomerPortalCustomer

Errors

Error TypeStatus CodeContent Type
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

list_payment_methods

Get saved payment methods of the authenticated customer.

Example Usage

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()

Parameters

ParameterTypeRequiredDescription
securitymodels.CustomerPortalCustomersListPaymentMethodsSecurity:heavy_check_mark:N/A
pageOptional[int]:heavy_minus_sign:Page number, defaults to 1.
limitOptional[int]:heavy_minus_sign:Size of a page, defaults to 10. Maximum is 100.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.CustomerPortalCustomersListPaymentMethodsResponse

Errors

Error TypeStatus CodeContent Type
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

add_payment_method

Add a payment method to the authenticated customer.

Example Usage

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)

Parameters

ParameterTypeRequiredDescription
requestmodels.CustomerPaymentMethodCreate:heavy_check_mark:The request object to use for the request.
securitymodels.CustomerPortalCustomersAddPaymentMethodSecurity:heavy_check_mark:The security requirements to use for the request.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.CustomerPaymentMethodCreateResponse

Errors

Error TypeStatus CodeContent Type
models.PaymentMethodSetupFailed400application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

confirm_payment_method

Confirm a payment method for the authenticated customer.

Example Usage

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)

Parameters

ParameterTypeRequiredDescription
requestmodels.CustomerPaymentMethodConfirm:heavy_check_mark:The request object to use for the request.
securitymodels.CustomerPortalCustomersConfirmPaymentMethodSecurity:heavy_check_mark:The security requirements to use for the request.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.CustomerPaymentMethodCreateResponse

Errors

Error TypeStatus CodeContent Type
models.CustomerNotReady400application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

delete_payment_method

Delete a payment method from the authenticated customer.

Example Usage

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 ...

Parameters

ParameterTypeRequiredDescription
securitymodels.CustomerPortalCustomersDeletePaymentMethodSecurity:heavy_check_mark:N/A
idstr:heavy_check_mark:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Errors

Error TypeStatus CodeContent Type
models.PaymentMethodInUseByActiveSubscription400application/json
models.ResourceNotFound404application/json
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

request_email_update

Request an email change for the authenticated customer.

Example Usage

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)

Parameters

ParameterTypeRequiredDescription
requestmodels.CustomerEmailUpdateRequest:heavy_check_mark:The request object to use for the request.
securitymodels.CustomerPortalCustomersRequestEmailUpdateSecurity:heavy_check_mark:The security requirements to use for the request.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

Any

Errors

Error TypeStatus CodeContent Type
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

check_email_update

Check if an email change verification token is still valid.

Example Usage

from polar_sdk import Polar


with Polar() as polar:

    polar.customer_portal.customers.check_email_update(token="<value>")

    # Use the SDK ...

Parameters

ParameterTypeRequiredDescription
tokenstr:heavy_check_mark:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Errors

Error TypeStatus CodeContent Type
models.HTTPValidationError422application/json
models.SDKError4XX, 5XX*/*

verify_email_update

Verify an email change using the token from the verification email.

Example Usage

from polar_sdk import Polar


with Polar() as polar:

    res = polar.customer_portal.customers.verify_email_update(request={
        "token": "<value>",
    })

    # Handle response
    print(res)

Parameters

ParameterTypeRequiredDescription
requestmodels.CustomerEmailUpdateVerifyRequest:heavy_check_mark:The request object to use for the request.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.CustomerEmailUpdateVerifyResponse

Errors

Error TypeStatus CodeContent Type
models.SDKError4XX, 5XX*/*