Customer Portal API
Update Customer
Update authenticated customer.
PATCH
/
v1
/
customer-portal
/
customers
/
me
Go (SDK)
package main
import(
"context"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/components"
"os"
"github.com/polarsource/polar-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New()
res, err := s.CustomerPortal.Customers.Update(ctx, components.CustomerPortalCustomerUpdate{
BillingAddress: &components.AddressInput{
Country: components.AddressInputCountryAlpha2InputUs,
},
}, operations.CustomerPortalCustomersUpdateSecurity{
CustomerSession: polargo.Pointer(os.Getenv("POLAR_CUSTOMER_SESSION")),
})
if err != nil {
log.Fatal(err)
}
if res.CustomerPortalCustomer != nil {
// handle response
}
}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)import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.customers.update({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
billingAddress: {
country: "US",
},
});
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Components;
use Polar\Models\Operations;
$sdk = Polar\Polar::builder()->build();
$request = new Components\CustomerPortalCustomerUpdate(
billingAddress: new Components\AddressInput(
country: Components\AddressInputCountryAlpha2Input::Us,
),
);
$requestSecurity = new Operations\CustomerPortalCustomersUpdateSecurity(
customerSession: '<YOUR_BEARER_TOKEN_HERE>',
);
$response = $sdk->customerPortal->customers->update(
request: $request,
security: $requestSecurity
);
if ($response->customerPortalCustomer !== null) {
// handle response
}curl --request PATCH \
--url https://api.polar.sh/v1/customer-portal/customers/me \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"billing_name": "<string>",
"billing_address": {
"line1": "<string>",
"line2": "<string>",
"postal_code": "<string>",
"city": "<string>",
"state": "<string>"
},
"tax_id": "<string>",
"default_payment_method_id": "<string>"
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
billing_name: '<string>',
billing_address: {
line1: '<string>',
line2: '<string>',
postal_code: '<string>',
city: '<string>',
state: '<string>'
},
tax_id: '<string>',
default_payment_method_id: '<string>'
})
};
fetch('https://api.polar.sh/v1/customer-portal/customers/me', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.patch("https://api.polar.sh/v1/customer-portal/customers/me")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"billing_name\": \"<string>\",\n \"billing_address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"tax_id\": \"<string>\",\n \"default_payment_method_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/customer-portal/customers/me")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"billing_name\": \"<string>\",\n \"billing_address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"tax_id\": \"<string>\",\n \"default_payment_method_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"email": "<string>",
"email_verified": true,
"name": "<string>",
"billing_name": "<string>",
"billing_address": {
"line1": "<string>",
"line2": "<string>",
"postal_code": "<string>",
"city": "<string>",
"state": "<string>"
},
"tax_id": {
"[0]": "<string>"
},
"oauth_accounts": {},
"default_payment_method_id": "<string>",
"locale": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}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.
Body
application/json
Response
Customer updated.
Creation timestamp of the object.
Last modification timestamp of the object.
The ID of the object.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available options:
individual, team Was this page helpful?
⌘I
Go (SDK)
package main
import(
"context"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/components"
"os"
"github.com/polarsource/polar-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New()
res, err := s.CustomerPortal.Customers.Update(ctx, components.CustomerPortalCustomerUpdate{
BillingAddress: &components.AddressInput{
Country: components.AddressInputCountryAlpha2InputUs,
},
}, operations.CustomerPortalCustomersUpdateSecurity{
CustomerSession: polargo.Pointer(os.Getenv("POLAR_CUSTOMER_SESSION")),
})
if err != nil {
log.Fatal(err)
}
if res.CustomerPortalCustomer != nil {
// handle response
}
}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)import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.customers.update({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
billingAddress: {
country: "US",
},
});
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Components;
use Polar\Models\Operations;
$sdk = Polar\Polar::builder()->build();
$request = new Components\CustomerPortalCustomerUpdate(
billingAddress: new Components\AddressInput(
country: Components\AddressInputCountryAlpha2Input::Us,
),
);
$requestSecurity = new Operations\CustomerPortalCustomersUpdateSecurity(
customerSession: '<YOUR_BEARER_TOKEN_HERE>',
);
$response = $sdk->customerPortal->customers->update(
request: $request,
security: $requestSecurity
);
if ($response->customerPortalCustomer !== null) {
// handle response
}curl --request PATCH \
--url https://api.polar.sh/v1/customer-portal/customers/me \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"billing_name": "<string>",
"billing_address": {
"line1": "<string>",
"line2": "<string>",
"postal_code": "<string>",
"city": "<string>",
"state": "<string>"
},
"tax_id": "<string>",
"default_payment_method_id": "<string>"
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
billing_name: '<string>',
billing_address: {
line1: '<string>',
line2: '<string>',
postal_code: '<string>',
city: '<string>',
state: '<string>'
},
tax_id: '<string>',
default_payment_method_id: '<string>'
})
};
fetch('https://api.polar.sh/v1/customer-portal/customers/me', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.patch("https://api.polar.sh/v1/customer-portal/customers/me")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"billing_name\": \"<string>\",\n \"billing_address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"tax_id\": \"<string>\",\n \"default_payment_method_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/customer-portal/customers/me")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"billing_name\": \"<string>\",\n \"billing_address\": {\n \"line1\": \"<string>\",\n \"line2\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"tax_id\": \"<string>\",\n \"default_payment_method_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"email": "<string>",
"email_verified": true,
"name": "<string>",
"billing_name": "<string>",
"billing_address": {
"line1": "<string>",
"line2": "<string>",
"postal_code": "<string>",
"city": "<string>",
"state": "<string>"
},
"tax_id": {
"[0]": "<string>"
},
"oauth_accounts": {},
"default_payment_method_id": "<string>",
"locale": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}
