(Checkouts.Custom)
- List - List Checkout Sessions
- Create - Create Checkout Session
- Get - Get Checkout Session
- Update - Update Checkout Session
- ClientGet - Get Checkout Session from Client
- ClientUpdate - Update Checkout Session from Client
- ClientConfirm - Confirm Checkout Session from Client
List checkout sessions.
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.Checkouts.Custom.List(ctx, operations.CheckoutsCustomListRequest{})
if err != nil {
log.Fatal(err)
}
if res.ListResourceCheckout != 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.CheckoutsCustomListRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CheckoutsCustomListResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.HTTPValidationError | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Create a checkout session.
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.Checkouts.Custom.Create(ctx, components.CreateCheckoutCreateCheckoutProductCreate(
components.CheckoutProductCreate{
ProductID: "<value>",
},
))
if err != nil {
log.Fatal(err)
}
if res.Checkout != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
components.CheckoutCreate | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CheckoutsCustomCreateResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.HTTPValidationError | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Get a checkout session by ID.
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.Checkouts.Custom.Get(ctx, "<value>")
if err != nil {
log.Fatal(err)
}
if res.Checkout != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string | ✔️ | The checkout session ID. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CheckoutsCustomGetResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ResourceNotFound | 404 | application/json |
apierrors.HTTPValidationError | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Update a checkout session.
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.Checkouts.Custom.Update(ctx, "<value>", components.CheckoutUpdate{})
if err != nil {
log.Fatal(err)
}
if res.Checkout != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string | ✔️ | The checkout session ID. |
checkoutUpdate |
components.CheckoutUpdate | ✔️ | N/A |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CheckoutsCustomUpdateResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ResourceNotFound | 404 | application/json |
apierrors.HTTPValidationError | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Get a checkout session by client secret.
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.Checkouts.Custom.ClientGet(ctx, "<value>")
if err != nil {
log.Fatal(err)
}
if res.CheckoutPublic != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
clientSecret |
string | ✔️ | The checkout session client secret. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CheckoutsCustomClientGetResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ResourceNotFound | 404 | application/json |
apierrors.HTTPValidationError | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Update a checkout session by client secret.
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.Checkouts.Custom.ClientUpdate(ctx, "<value>", components.CheckoutUpdatePublic{})
if err != nil {
log.Fatal(err)
}
if res.CheckoutPublic != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
clientSecret |
string | ✔️ | The checkout session client secret. |
checkoutUpdatePublic |
components.CheckoutUpdatePublic | ✔️ | N/A |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CheckoutsCustomClientUpdateResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ResourceNotFound | 404 | application/json |
apierrors.HTTPValidationError | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Confirm a checkout session by client secret.
Orders and subscriptions will be processed.
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.Checkouts.Custom.ClientConfirm(ctx, "<value>", components.CheckoutConfirmStripe{})
if err != nil {
log.Fatal(err)
}
if res.CheckoutPublicConfirmed != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
clientSecret |
string | ✔️ | The checkout session client secret. |
checkoutConfirmStripe |
components.CheckoutConfirmStripe | ✔️ | N/A |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CheckoutsCustomClientConfirmResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ResourceNotFound | 404 | application/json |
apierrors.HTTPValidationError | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |