- list - List Orders
- get - Get Order
- update - Update Order
- invoice - Get Order Invoice
- generateInvoice - Generate Order Invoice
- receipt - Get Order Receipt
- getPaymentStatus - Get Order Payment Status
- confirmRetryPayment - Confirm Retry Payment
List orders of the authenticated customer.
import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.orders.list({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {});
for await (const page of result) {
console.log(page);
}
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalOrdersList } from "@polar-sh/sdk/funcs/customerPortalOrdersList.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore();
async function run() {
const res = await customerPortalOrdersList(polar, {
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {});
if (res.ok) {
const { value: result } = res;
for await (const page of result) {
console.log(page);
}
} else {
console.log("customerPortalOrdersList failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CustomerPortalOrdersListRequest | ✔️ | The request object to use for the request. |
security |
operations.CustomerPortalOrdersListSecurity | ✔️ | The security requirements to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.CustomerPortalOrdersListResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Get an order by ID for the authenticated customer.
import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.orders.get({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalOrdersGet } from "@polar-sh/sdk/funcs/customerPortalOrdersGet.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore();
async function run() {
const res = await customerPortalOrdersGet(polar, {
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("customerPortalOrdersGet failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CustomerPortalOrdersGetRequest | ✔️ | The request object to use for the request. |
security |
operations.CustomerPortalOrdersGetSecurity | ✔️ | The security requirements to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.CustomerOrder>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Update an order for the authenticated customer.
import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.orders.update({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
customerOrderUpdate: {
billingAddress: {
country: "US",
},
},
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalOrdersUpdate } from "@polar-sh/sdk/funcs/customerPortalOrdersUpdate.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore();
async function run() {
const res = await customerPortalOrdersUpdate(polar, {
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
customerOrderUpdate: {
billingAddress: {
country: "US",
},
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("customerPortalOrdersUpdate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CustomerPortalOrdersUpdateRequest | ✔️ | The request object to use for the request. |
security |
operations.CustomerPortalOrdersUpdateSecurity | ✔️ | The security requirements to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.CustomerOrder>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Get an order's invoice data.
import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.orders.invoice({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalOrdersInvoice } from "@polar-sh/sdk/funcs/customerPortalOrdersInvoice.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore();
async function run() {
const res = await customerPortalOrdersInvoice(polar, {
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("customerPortalOrdersInvoice failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CustomerPortalOrdersInvoiceRequest | ✔️ | The request object to use for the request. |
security |
operations.CustomerPortalOrdersInvoiceSecurity | ✔️ | The security requirements to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.CustomerOrderInvoice>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Trigger generation of an order's invoice.
import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.orders.generateInvoice({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalOrdersGenerateInvoice } from "@polar-sh/sdk/funcs/customerPortalOrdersGenerateInvoice.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore();
async function run() {
const res = await customerPortalOrdersGenerateInvoice(polar, {
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("customerPortalOrdersGenerateInvoice failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CustomerPortalOrdersGenerateInvoiceRequest | ✔️ | The request object to use for the request. |
security |
operations.CustomerPortalOrdersGenerateInvoiceSecurity | ✔️ | The security requirements to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<any>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ResourceNotFound | 404 | application/json |
| errors.OrderNotEligibleForInvoice | 409 | application/json |
| errors.MissingInvoiceBillingDetails | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Get a presigned URL to download an order's receipt PDF.
import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.orders.receipt({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalOrdersReceipt } from "@polar-sh/sdk/funcs/customerPortalOrdersReceipt.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore();
async function run() {
const res = await customerPortalOrdersReceipt(polar, {
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("customerPortalOrdersReceipt failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CustomerPortalOrdersReceiptRequest | ✔️ | The request object to use for the request. |
security |
operations.CustomerPortalOrdersReceiptSecurity | ✔️ | The security requirements to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.CustomerOrderReceipt>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Get the current payment status for an order.
import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.orders.getPaymentStatus({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalOrdersGetPaymentStatus } from "@polar-sh/sdk/funcs/customerPortalOrdersGetPaymentStatus.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore();
async function run() {
const res = await customerPortalOrdersGetPaymentStatus(polar, {
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("customerPortalOrdersGetPaymentStatus failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CustomerPortalOrdersGetPaymentStatusRequest | ✔️ | The request object to use for the request. |
security |
operations.CustomerPortalOrdersGetPaymentStatusSecurity | ✔️ | The security requirements to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.CustomerOrderPaymentStatus>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Confirm a retry payment using a Stripe confirmation token.
import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.orders.confirmRetryPayment({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
customerOrderConfirmPayment: {},
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalOrdersConfirmRetryPayment } from "@polar-sh/sdk/funcs/customerPortalOrdersConfirmRetryPayment.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore();
async function run() {
const res = await customerPortalOrdersConfirmRetryPayment(polar, {
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
customerOrderConfirmPayment: {},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("customerPortalOrdersConfirmRetryPayment failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CustomerPortalOrdersConfirmRetryPaymentRequest | ✔️ | The request object to use for the request. |
security |
operations.CustomerPortalOrdersConfirmRetryPaymentSecurity | ✔️ | The security requirements to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.CustomerOrderPaymentConfirmation>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ResourceNotFound | 404 | application/json |
| errors.PaymentAlreadyInProgress | 409 | application/json |
| errors.OrderNotEligibleForRetry | 422 | application/json |
| errors.ManualRetryLimitExceeded | 429 | application/json |
| errors.SDKError | 4XX, 5XX | */* |