PATCH
/
v1
/
checkouts
/
client
/
{client_secret}
package main

import(
	"context"
	polargo "github.com/polarsource/polar-go"
	"github.com/polarsource/polar-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := polargo.New()

    res, err := s.Checkouts.ClientUpdate(ctx, "<value>", components.CheckoutUpdatePublic{
        CustomerBillingAddress: &components.Address{
            Country: "FR",
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.CheckoutPublic != nil {
        // handle response
    }
}
{
  "created_at": "2023-11-07T05:31:56Z",
  "modified_at": "2023-11-07T05:31:56Z",
  "id": "<string>",
  "custom_field_data": {},
  "payment_processor": "stripe",
  "status": "open",
  "client_secret": "<string>",
  "url": "<string>",
  "expires_at": "2023-11-07T05:31:56Z",
  "success_url": "<string>",
  "embed_origin": "<string>",
  "amount": 123,
  "discount_amount": 123,
  "net_amount": 123,
  "tax_amount": 123,
  "total_amount": 123,
  "currency": "<string>",
  "product_id": "<string>",
  "product_price_id": "<string>",
  "discount_id": "<string>",
  "allow_discount_codes": true,
  "require_billing_address": true,
  "is_discount_applicable": true,
  "is_free_product_price": true,
  "is_payment_required": true,
  "is_payment_setup_required": true,
  "is_payment_form_required": true,
  "customer_id": "<string>",
  "customer_name": "<string>",
  "customer_email": "<string>",
  "customer_ip_address": "<string>",
  "customer_billing_address": {
    "line1": "<string>",
    "line2": "<string>",
    "postal_code": "<string>",
    "city": "<string>",
    "state": "<string>",
    "country": "US"
  },
  "customer_tax_id": "<string>",
  "payment_processor_metadata": {},
  "products": [
    {
      "created_at": "2023-11-07T05:31:56Z",
      "modified_at": "2023-11-07T05:31:56Z",
      "id": "<string>",
      "name": "<string>",
      "description": "<string>",
      "recurring_interval": "month",
      "is_recurring": true,
      "is_archived": true,
      "organization_id": "<string>",
      "prices": [
        {
          "created_at": "2023-11-07T05:31:56Z",
          "modified_at": "2023-11-07T05:31:56Z",
          "id": "<string>",
          "amount_type": "<string>",
          "is_archived": true,
          "product_id": "<string>",
          "type": "<string>",
          "recurring_interval": "month",
          "price_currency": "<string>",
          "price_amount": 123,
          "legacy": true
        }
      ],
      "benefits": [
        {
          "id": "<string>",
          "created_at": "2023-11-07T05:31:56Z",
          "modified_at": "2023-11-07T05:31:56Z",
          "type": "custom",
          "description": "<string>",
          "selectable": true,
          "deletable": true,
          "organization_id": "<string>"
        }
      ],
      "medias": [
        {
          "id": "<string>",
          "organization_id": "<string>",
          "name": "<string>",
          "path": "<string>",
          "mime_type": "<string>",
          "size": 123,
          "storage_version": "<string>",
          "checksum_etag": "<string>",
          "checksum_sha256_base64": "<string>",
          "checksum_sha256_hex": "<string>",
          "last_modified_at": "2023-11-07T05:31:56Z",
          "version": "<string>",
          "service": "<string>",
          "is_uploaded": true,
          "created_at": "2023-11-07T05:31:56Z",
          "size_readable": "<string>",
          "public_url": "<string>"
        }
      ]
    }
  ],
  "product": {
    "created_at": "2023-11-07T05:31:56Z",
    "modified_at": "2023-11-07T05:31:56Z",
    "id": "<string>",
    "name": "<string>",
    "description": "<string>",
    "recurring_interval": "month",
    "is_recurring": true,
    "is_archived": true,
    "organization_id": "<string>",
    "prices": [
      {
        "created_at": "2023-11-07T05:31:56Z",
        "modified_at": "2023-11-07T05:31:56Z",
        "id": "<string>",
        "amount_type": "<string>",
        "is_archived": true,
        "product_id": "<string>",
        "type": "<string>",
        "recurring_interval": "month",
        "price_currency": "<string>",
        "price_amount": 123,
        "legacy": true
      }
    ],
    "benefits": [
      {
        "id": "<string>",
        "created_at": "2023-11-07T05:31:56Z",
        "modified_at": "2023-11-07T05:31:56Z",
        "type": "custom",
        "description": "<string>",
        "selectable": true,
        "deletable": true,
        "organization_id": "<string>"
      }
    ],
    "medias": [
      {
        "id": "<string>",
        "organization_id": "<string>",
        "name": "<string>",
        "path": "<string>",
        "mime_type": "<string>",
        "size": 123,
        "storage_version": "<string>",
        "checksum_etag": "<string>",
        "checksum_sha256_base64": "<string>",
        "checksum_sha256_hex": "<string>",
        "last_modified_at": "2023-11-07T05:31:56Z",
        "version": "<string>",
        "service": "<string>",
        "is_uploaded": true,
        "created_at": "2023-11-07T05:31:56Z",
        "size_readable": "<string>",
        "public_url": "<string>"
      }
    ]
  },
  "product_price": {
    "created_at": "2023-11-07T05:31:56Z",
    "modified_at": "2023-11-07T05:31:56Z",
    "id": "<string>",
    "amount_type": "<string>",
    "is_archived": true,
    "product_id": "<string>",
    "type": "<string>",
    "recurring_interval": "month",
    "price_currency": "<string>",
    "price_amount": 123,
    "legacy": true
  },
  "discount": {
    "duration": "once",
    "type": "fixed",
    "amount": 123,
    "currency": "<string>",
    "id": "<string>",
    "name": "<string>",
    "code": "<string>"
  },
  "organization": {
    "created_at": "2023-11-07T05:31:56Z",
    "modified_at": "2023-11-07T05:31:56Z",
    "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
    "name": "<string>",
    "slug": "<string>",
    "avatar_url": "<string>",
    "email": "<string>",
    "website": "<string>",
    "socials": [
      {
        "platform": "x",
        "url": "<string>"
      }
    ],
    "details_submitted_at": "2023-11-07T05:31:56Z",
    "feature_settings": {
      "issue_funding_enabled": false,
      "usage_based_billing_enabled": false
    },
    "subscription_settings": {
      "allow_multiple_subscriptions": true,
      "allow_customer_updates": true,
      "proration_behavior": "invoice"
    }
  },
  "attached_custom_fields": [
    {
      "custom_field_id": "<string>",
      "custom_field": {
        "created_at": "2023-11-07T05:31:56Z",
        "modified_at": "2023-11-07T05:31:56Z",
        "id": "<string>",
        "metadata": {},
        "type": "<string>",
        "slug": "<string>",
        "name": "<string>",
        "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
        "properties": {
          "form_label": "<string>",
          "form_help_text": "<string>",
          "form_placeholder": "<string>",
          "textarea": true,
          "min_length": 1,
          "max_length": 1
        }
      },
      "order": 123,
      "required": true
    }
  ],
  "customer_billing_address_fields": {
    "country": true,
    "state": true,
    "city": true,
    "postal_code": true,
    "line1": true,
    "line2": true
  }
}

Path Parameters

client_secret
string
required

The checkout session client secret.

Body

application/json

Update an existing checkout session using the client secret.

custom_field_data
object

Key-value object storing custom field values.

product_id
string | null

ID of the product to checkout. Must be present in the checkout's product list.

product_price_id
string | null
deprecated

ID of the product price to checkout. Must correspond to a price present in the checkout's product list.

amount
integer | null

Amount in cents, before discounts and taxes. Only useful for custom prices, it'll be ignored for fixed and free prices.

Required range: 50 <= x <= 99999999
customer_name
string | null

Name of the customer.

customer_email
string | null

Email address of the customer.

customer_billing_address
object | null

Billing address of the customer.

customer_tax_id
string | null
discount_code
string | null

Discount code to apply to the checkout.

Response

200
application/json
Checkout session updated.

Checkout session data retrieved using the client secret.

created_at
string
required

Creation timestamp of the object.

modified_at
string | null
required

Last modification timestamp of the object.

id
string
required

The ID of the object.

payment_processor
enum<string>
required

Payment processor used.

Available options:
stripe
status
enum<string>
required

Status of the checkout session.

Available options:
open,
expired,
confirmed,
succeeded,
failed
client_secret
string
required

Client secret used to update and complete the checkout session from the client.

url
string
required

URL where the customer can access the checkout session.

expires_at
string
required

Expiration date and time of the checkout session.

success_url
string
required

URL where the customer will be redirected after a successful payment.

embed_origin
string | null
required

When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page.

amount
integer
required

Amount in cents, before discounts and taxes.

discount_amount
integer
required

Discount amount in cents.

net_amount
integer
required

Amount in cents, after discounts but before taxes.

tax_amount
integer | null
required

Sales tax amount in cents. If null, it means there is no enough information yet to calculate it.

total_amount
integer
required

Amount in cents, after discounts and taxes.

currency
string
required

Currency code of the checkout session.

product_id
string
required

ID of the product to checkout.

product_price_id
string
required

ID of the product price to checkout.

discount_id
string | null
required

ID of the discount applied to the checkout.

allow_discount_codes
boolean
required

Whether to allow the customer to apply discount codes. If you apply a discount through discount_id, it'll still be applied, but the customer won't be able to change it.

require_billing_address
boolean
required

Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to true.

is_discount_applicable
boolean
required

Whether the discount is applicable to the checkout. Typically, free and custom prices are not discountable.

is_free_product_price
boolean
required

Whether the product price is free, regardless of discounts.

is_payment_required
boolean
required

Whether the checkout requires payment, e.g. in case of free products or discounts that cover the total amount.

is_payment_setup_required
boolean
required

Whether the checkout requires setting up a payment method, regardless of the amount, e.g. subscriptions that have first free cycles.

is_payment_form_required
boolean
required

Whether the checkout requires a payment form, whether because of a payment or payment method setup.

customer_id
string | null
required
customer_name
string | null
required

Name of the customer.

customer_email
string | null
required

Email address of the customer.

customer_ip_address
string | null
required
customer_billing_address
object | null
required

Billing address of the customer.

customer_tax_id
string | null
required
payment_processor_metadata
object
required
products
object[]
required

List of products available to select.

Product data for a checkout session.

product
object
required

Product selected to checkout.

product_price
object
required

Price of the selected product.

discount
object | null
required

Schema for a fixed amount discount that is applied once or forever.

organization
object
required
attached_custom_fields
object[]
required

Schema of a custom field attached to a resource.

customer_billing_address_fields
object
required

Determine which billing address fields should be shown in the checkout form.

custom_field_data
object

Key-value object storing custom field values.