(customerPortal.orders)
List orders of the authenticated customer or user.
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.customerPortal.orders.list({});
for await (const page of result) {
// Handle the page
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({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await customerPortalOrdersList(polar, {});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CustomerPortalOrdersListRequest | ✔️ | The request object 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 or user.
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.customerPortal.orders.get({
id: "<value>",
});
// Handle the result
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({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await customerPortalOrdersGet(polar, {
id: "<value>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CustomerPortalOrdersGetRequest | ✔️ | The request object 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({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.customerPortal.orders.invoice({
id: "<value>",
});
// Handle the result
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({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await customerPortalOrdersInvoice(polar, {
id: "<value>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CustomerPortalOrdersInvoiceRequest | ✔️ | The request object 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 | */* |