Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计提醒

flowglad-checkoutFlowglad 结帐

Agent Skill

flowglad-checkout 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

447

周安装

19

GitHub Stars

2

下载量

157
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:flowglad-checkout(Flowglad 结帐)
来源仓库:https://github.com/flowglad/skills
仓库路径:skills/flowglad-checkout
安装命令:
npx skills add https://github.com/flowglad/skills --skill flowglad-checkout
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/flowglad/skills --skill flowglad-checkout

简介

flowglad-checkout 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中快速定位候选结果。

  • 适用于关键词搜索、任务场景匹配或来源线索筛选等研究检索场景。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装并使用该技能。
  • 安装前需确认权限范围、维护状态及是否触发联网或文件操作。
  • 建议结合原始 README 和仓库路径进一步核验具体用法和功能边界。

SKILL.md

Checkout

Abstract

This skill covers implementing checkout sessions for purchasing subscriptions and products with Flowglad. It includes creating upgrade buttons, handling redirects to hosted checkout pages, and displaying pricing information from the pricing model.


Table of Contents

  1. Success and Cancel URL HandlingCRITICAL

- 1.1 Use Absolute URLs - 1.2 Include Post-Checkout Context

  1. Price Slug vs Price IDHIGH

- 2.1 Use Slugs for Stability

  1. autoRedirect BehaviorMEDIUM

- 3.1 When to Use autoRedirect - 3.2 Manual Redirect Control

  1. Building Upgrade ButtonsMEDIUM

- 4.1 Loading States During Checkout - 4.2 Disabling During Billing Load

  1. Displaying Pricing from pricingModelMEDIUM

- 5.1 Accessing Prices and Products - 5.2 Formatting Price Display


1. Success and Cancel URL Handling

Impact: CRITICAL

Checkout sessions require successUrl and cancelUrl parameters. These URLs determine where users are redirected after completing or abandoning checkout. Incorrect URL handling causes broken redirects and poor user experience.

1.1 Use Absolute URLs

Impact: CRITICAL (relative URLs will fail)

Flowglad's hosted checkout redirects users via HTTP redirect, which requires fully-qualified absolute URLs.

Incorrect: using relative URLs

const handleUpgrade = async () => {
  await createCheckoutSession({
    priceSlug: 'pro-monthly',
    // FAILS: relative URLs don't work with external redirects
    successUrl: '/dashboard?upgraded=true',
    cancelUrl: '/pricing',
    autoRedirect: true,
  })
}

Relative URLs cause redirect failures because the hosted checkout page is on a different domain and cannot resolve relative paths.

Correct: use absolute URLs with window.location.origin

const handleUpgrade = async () => {
  await createCheckoutSession({
    priceSlug: 'pro-monthly',
    successUrl: `${window.location.origin}/dashboard?upgraded=true`,
    cancelUrl: `${window.location.origin}/pricing`,
    autoRedirect: true,
  })
}

1.2 Include Post-Checkout Context

Impact: MEDIUM (improves user experience)

Include query parameters in success URLs to trigger appropriate UI feedback.

Incorrect: no context after checkout

await createCheckoutSession({
  priceSlug: 'pro-monthly',
  successUrl: `${window.location.origin}/dashboard`,
  cancelUrl: window.location.href,
  autoRedirect: true,
})

User returns to dashboard with no indication that checkout succeeded.

Correct: include success context

await createCheckoutSession({
  priceSlug: 'pro-monthly',
  successUrl: `${window.location.origin}/dashboard?checkout=success&plan=pro`,
  cancelUrl: window.location.href,
  autoRedirect: true,
})

// Then in the dashboard component:
const searchParams = useSearchParams()
const checkoutSuccess = searchParams.get('checkout') === 'success'

{checkoutSuccess && (
  <SuccessBanner>Welcome to Pro! Your subscription is now active.</SuccessBanner>
)}

2. Price Slug vs Price ID

Impact: HIGH

Flowglad supports referencing prices by either priceId or priceSlug. Using slugs provides stability across environments.

2.1 Use Slugs for Stability

Impact: HIGH (IDs differ between environments)

Price IDs are auto-generated and differ between development, staging, and production environments. Slugs are user-defined and consistent.

Incorrect: hardcoding price IDs

await createCheckoutSession({
  // This ID only exists in production!
  priceId: 'price_abc123xyz',
  successUrl: `${window.location.origin}/success`,
  cancelUrl: window.location.href,
  autoRedirect: true,
})

Code breaks when deployed to different environments because each environment has different price IDs.

Correct: use price slugs

await createCheckoutSession({
  // Slugs are consistent across all environments
  priceSlug: 'pro-monthly',
  successUrl: `${window.location.origin}/success`,
  cancelUrl: window.location.href,
  autoRedirect: true,
})

When using priceSlug, ensure the slug is defined in your Flowglad dashboard for all environments. Slugs are case-sensitive.


3. autoRedirect Behavior

Impact: MEDIUM

The autoRedirect option controls whether users are automatically sent to the hosted checkout page.

3.1 When to Use autoRedirect

Impact: MEDIUM (simplifies common flows)

For most checkout buttons, autoRedirect: true provides the expected behavior.

Incorrect: manually redirecting when autoRedirect would suffice

const handleUpgrade = async () => {
  const result = await createCheckoutSession({
    priceSlug: 'pro-monthly',
    successUrl: `${window.location.origin}/success`,
    cancelUrl: window.location.href,
    // Missing autoRedirect
  })

  // Unnecessary manual redirect
  if (result.url) {
    window.location.href = result.url
  }
}

Correct: use autoRedirect for simple flows

const handleUpgrade = async () => {
  await createCheckoutSession({
    priceSlug: 'pro-monthly',
    successUrl: `${window.location.origin}/success`,
    cancelUrl: window.location.href,
    autoRedirect: true,
  })
  // No manual redirect needed - user is automatically sent to checkout
}

3.2 Manual Redirect Control

Impact: MEDIUM (needed for analytics or pre-redirect logic)

Disable autoRedirect when you need to perform actions before redirecting, such as analytics tracking.

Correct: manual control for analytics

const handleUpgrade = async () => {
  const result = await createCheckoutSession({
    priceSlug: 'pro-monthly',
    successUrl: `${window.location.origin}/success`,
    cancelUrl: window.location.href,
    autoRedirect: false, // Explicitly disable
  })

  if ('url' in result && result.url) {
    // Track checkout initiation before redirect
    await analytics.track('checkout_started', {
      priceSlug: 'pro-monthly',
      checkoutSessionId: result.id,
    })

    // Then manually redirect
    window.location.href = result.url
  }
}

4. Building Upgrade Buttons

Impact: MEDIUM

Upgrade buttons must handle loading states and errors gracefully.

4.1 Loading States During Checkout

Impact: MEDIUM (prevents double-clicks and shows feedback)

Checkout session creation is asynchronous. Buttons should show loading state and be disabled during the request.

Incorrect: no loading state

function UpgradeButton({ priceSlug }: { priceSlug: string }) {
  const { createCheckoutSession } = useBilling()

  const handleClick = async () => {
    // User can click multiple times while request is pending
    await createCheckoutSession({
      priceSlug,
      successUrl: `${window.location.origin}/success`,
      cancelUrl: window.location.href,
      autoRedirect: true,
    })
  }

  return <button onClick={handleClick}>Upgrade</button>
}

Correct: with loading state

function UpgradeButton({ priceSlug }: { priceSlug: string }) {
  const { createCheckoutSession } = useBilling()
  const [isLoading, setIsLoading] = useState(false)

  const handleClick = async () => {
    setIsLoading(true)
    try {
      await createCheckoutSession({
        priceSlug,
        successUrl: `${window.location.origin}/success`,
        cancelUrl: window.location.href,
        autoRedirect: true,
      })
    } catch (error) {
      // Handle error (show toast, etc.)
      console.error('Checkout failed:', error)
      setIsLoading(false)
    }
    // Note: don't setIsLoading(false) on success because
    // autoRedirect will navigate away from the page
  }

  return (
    <button onClick={handleClick} disabled={isLoading}>
      {isLoading ? 'Loading...' : 'Upgrade'}
    </button>
  )
}

4.2 Disabling During Billing Load

Impact: MEDIUM (prevents errors from undefined methods)

The useBilling hook returns loaded: false until billing data is fetched. Checkout methods should not be called before loading completes.

Incorrect: not checking loaded state

function UpgradeButton({ priceSlug }: { priceSlug: string }) {
  const { createCheckoutSession } = useBilling()

  // createCheckoutSession may throw if called before loaded
  return <button onClick={() => createCheckoutSession({...})}>Upgrade</button>
}

Correct: check loaded state

function UpgradeButton({ priceSlug }: { priceSlug: string }) {
  const { loaded, createCheckoutSession } = useBilling()
  const [isLoading, setIsLoading] = useState(false)

  const handleClick = async () => {
    if (!loaded) return

    setIsLoading(true)
    try {
      await createCheckoutSession({
        priceSlug,
        successUrl: `${window.location.origin}/success`,
        cancelUrl: window.location.href,
        autoRedirect: true,
      })
    } catch (error) {
      console.error('Checkout failed:', error)
      setIsLoading(false)
    }
  }

  return (
    <button onClick={handleClick} disabled={!loaded || isLoading}>
      {!loaded ? 'Loading...' : isLoading ? 'Redirecting...' : 'Upgrade'}
    </button>
  )
}

5. Displaying Pricing from pricingModel

Impact: MEDIUM

The pricingModel from useBilling contains all products, prices, and usage meters configured in your Flowglad dashboard.

5.1 Accessing Prices and Products

Impact: MEDIUM (use helper functions for cleaner code)

Use the getPrice and getProduct helper functions instead of manually searching arrays.

Incorrect: manually searching arrays

function PricingCard({ priceSlug }: { priceSlug: string }) {
  const { pricingModel } = useBilling()

  // Verbose and error-prone
  const price = pricingModel?.prices.find(p => p.slug === priceSlug)
  const product = pricingModel?.products.find(
    p => p.id === price?.productId
  )

  return (
    <div>
      <h3>{product?.name}</h3>
      <p>${price?.unitPrice}</p>
    </div>
  )
}

Correct: use helper functions

function PricingCard({ priceSlug }: { priceSlug: string }) {
  const { loaded, getPrice, getProduct } = useBilling()

  if (!loaded) {
    return <LoadingSkeleton />
  }

  const price = getPrice(priceSlug)
  const product = price ? getProduct(price.productSlug) : null

  if (!price || !product) {
    return null
  }

  return (
    <div>
      <h3>{product.name}</h3>
      <p>${price.unitPrice / 100}/mo</p>
    </div>
  )
}

5.2 Formatting Price Display

Impact: MEDIUM (prices are in cents)

Prices in pricingModel are stored in cents (the smallest currency unit). Format for display.

Incorrect: displaying raw price value

function PriceDisplay({ priceSlug }: { priceSlug: string }) {
  const { getPrice } = useBilling()
  const price = getPrice(priceSlug)

  // Shows "1999" instead of "$19.99"
  return <span>{price?.unitPrice}</span>
}

Correct: format price for display

function PriceDisplay({ priceSlug }: { priceSlug: string }) {
  const { loaded, getPrice } = useBilling()

  if (!loaded) return <span>--</span>

  const price = getPrice(priceSlug)
  if (!price) return <span>--</span>

  const formattedPrice = new Intl.NumberFormat('en-US', {
    style: 'currency',
    currency: price.currency || 'USD',
  }).format(price.unitPrice / 100)

  const interval = price.intervalUnit === 'month' ? '/mo' : '/yr'

  return <span>{formattedPrice}{interval}</span>
}

For building complete pricing pages with product cards, monthly/annual toggles, and current plan highlighting, see the pricing-ui skill.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

30.63%
按下载量换算48

Claude Code

22.83%
按下载量换算36

Cursor

17.24%
按下载量换算27

OpenCode

11.73%
按下载量换算18

Gemini CLI

7.65%
按下载量换算12

Antigravity

3.18%
按下载量换算5

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills