(CustomerPortal.Orders)
List orders of the authenticated customer.
Scopes: customer_portal:read
customer_portal:write
package main
import(
"context"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/operations"
"os"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New()
res, err := s.CustomerPortal.Orders.List(ctx, operations.CustomerPortalOrdersListRequest{
OrganizationID: polargo.Pointer(operations.CreateCustomerPortalOrdersListQueryParamOrganizationIDFilterArrayOfStr(
[]string{
"1dbfc517-0bbf-4301-9ba8-555ca42b9737",
},
)),
}, operations.CustomerPortalOrdersListSecurity{
CustomerSession: os.Getenv("POLAR_CUSTOMER_SESSION"),
})
if err != nil {
log.Fatal(err)
}
if res.ListResourceCustomerOrder != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.CustomerPortalOrdersListRequest | ✔️ | The request object to use for the request. |
security |
operations.CustomerPortalOrdersListSecurity | ✔️ | The security requirements to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CustomerPortalOrdersListResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.HTTPValidationError | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Get an order by ID for the authenticated customer.
Scopes: customer_portal:read
customer_portal:write
package main
import(
"context"
polargo "github.com/polarsource/polar-go"
"os"
"github.com/polarsource/polar-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New()
res, err := s.CustomerPortal.Orders.Get(ctx, operations.CustomerPortalOrdersGetSecurity{
CustomerSession: os.Getenv("POLAR_CUSTOMER_SESSION"),
}, "<value>")
if err != nil {
log.Fatal(err)
}
if res.CustomerOrder != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
security |
operations.CustomerPortalOrdersGetSecurity | ✔️ | The security requirements to use for the request. |
id |
string | ✔️ | The order ID. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CustomerPortalOrdersGetResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ResourceNotFound | 404 | application/json |
apierrors.HTTPValidationError | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Get an order's invoice data.
Scopes: customer_portal:read
customer_portal:write
package main
import(
"context"
polargo "github.com/polarsource/polar-go"
"os"
"github.com/polarsource/polar-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New()
res, err := s.CustomerPortal.Orders.Invoice(ctx, operations.CustomerPortalOrdersInvoiceSecurity{
CustomerSession: os.Getenv("POLAR_CUSTOMER_SESSION"),
}, "<value>")
if err != nil {
log.Fatal(err)
}
if res.CustomerOrderInvoice != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
security |
operations.CustomerPortalOrdersInvoiceSecurity | ✔️ | The security requirements to use for the request. |
id |
string | ✔️ | The order ID. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CustomerPortalOrdersInvoiceResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ResourceNotFound | 404 | application/json |
apierrors.HTTPValidationError | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |