UNPKG

cosmic-payments

Version:

A payments library for cosmic.new. Designed to be used and deployed on cosmic.new

24 lines (23 loc) 683 B
import type { UseCosmicPaymentsResult } from '../types'; /** * Simple hook for Cosmic Payments integration * * @example * ```tsx * const { getProducts, checkout, hasAccess, loading, error } = useCosmicPayments(); * * // Get products * const products = await getProducts('subscription'); // or 'one-time' or 'all' * * // Start checkout (with optional guest checkout) * await checkout({ * priceId: price.price_id, * productId: product.product_id, * allowGuestCheckout: true // Optional, defaults to false * }); * * // Check access * const hasAccess = await hasAccess('prod_123'); * ``` */ export declare function useCosmicPayments(): UseCosmicPaymentsResult;