Payment Methods
List Customer Payment Methods
Get saved payment methods of the authenticated customer.
GET
/
v1
/
customer-portal
/
customers
/
me
/
payment-methods
python (new sdk)
from polar.v2026_04 import Polar
polar = Polar("polar_oat_xxx")
for item in polar.customer_portal.customers.iter_list_payment_methods(
page=1,
limit=10,
):
print(item)import { createPolar } from "@polar-sh/sdk/2026-04";
const polar = createPolar({
accessToken: "polar_oat_xxx",
});
for await (const item of polar.customerPortal.customers.iterListPaymentMethods(
{
"page": 1,
"limit": 10
},
)) {
console.log(item);
}curl --request GET \
--url https://api.polar.sh/v1/customer-portal/customers/me/payment-methods \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.polar.sh/v1/customer-portal/customers/me/payment-methods"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polar.sh/v1/customer-portal/customers/me/payment-methods', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.polar.sh/v1/customer-portal/customers/me/payment-methods",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.polar.sh/v1/customer-portal/customers/me/payment-methods"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.polar.sh/v1/customer-portal/customers/me/payment-methods")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/customer-portal/customers/me/payment-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"items": [
{
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"processor": "stripe",
"customer_id": "<string>",
"type": "<string>",
"method_metadata": {
"brand": "<string>",
"last4": "<string>",
"exp_month": 123,
"exp_year": 123,
"wallet": "<string>"
}
}
],
"pagination": {
"total_count": 123,
"max_page": 123
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}To change the default payment method, call the
PATCH /v1/customer-portal/customers/me endpoint with the desired default_payment_method_id.Authorizations
customer_sessionmember_session
Customer session tokens are specific tokens that are used to authenticate customers on your organization. You can create those sessions programmatically using the Create Customer Session endpoint.
Query Parameters
Page number, defaults to 1.
Size of a page, defaults to 10. Maximum is 100.
Was this page helpful?
⌘I
python (new sdk)
from polar.v2026_04 import Polar
polar = Polar("polar_oat_xxx")
for item in polar.customer_portal.customers.iter_list_payment_methods(
page=1,
limit=10,
):
print(item)import { createPolar } from "@polar-sh/sdk/2026-04";
const polar = createPolar({
accessToken: "polar_oat_xxx",
});
for await (const item of polar.customerPortal.customers.iterListPaymentMethods(
{
"page": 1,
"limit": 10
},
)) {
console.log(item);
}curl --request GET \
--url https://api.polar.sh/v1/customer-portal/customers/me/payment-methods \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.polar.sh/v1/customer-portal/customers/me/payment-methods"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polar.sh/v1/customer-portal/customers/me/payment-methods', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.polar.sh/v1/customer-portal/customers/me/payment-methods",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.polar.sh/v1/customer-portal/customers/me/payment-methods"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.polar.sh/v1/customer-portal/customers/me/payment-methods")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/customer-portal/customers/me/payment-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"items": [
{
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"processor": "stripe",
"customer_id": "<string>",
"type": "<string>",
"method_metadata": {
"brand": "<string>",
"last4": "<string>",
"exp_month": 123,
"exp_year": 123,
"wallet": "<string>"
}
}
],
"pagination": {
"total_count": 123,
"max_page": 123
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}
