Firmhouse for Developers
FirmhouseHelp CenterStatusPortal / Login
  • ❤️Firmhouse for Developers
  • GraphQL API
    • Introduction
    • Getting Started
    • Pagination
    • Handling Errors
    • API Reference
      • Queries
        • assets
        • currentCart
        • discountCodes
        • getCollectionCase
        • getCurrentProject
        • getDiscountCode
        • getInvoice
        • getOrder
        • getOrderBy
        • getOrderCalculations
        • getOrders
        • getPayment
        • getRefund
        • getServiceChannelBy
        • getSubscription
        • getSubscriptionAccount
        • getSubscriptionBySelfServiceCenterLoginToken
        • getSubscriptions
        • invoices
        • orderedProducts
        • orders
        • outstandingInvoices
        • payments
        • plans
        • products
        • returnOrders
        • subscriptionAccounts
        • subscriptions
      • Mutations
        • activateSubscription
        • applyPromotionToSubscription
        • assignAsset
        • cancelReturnOrder
        • cancelSubscription
        • completeReturnOrder
        • completeSubscriptionCancellation
        • createAsset
        • createCart
        • createDiscountCode
        • createInvoiceLineItem
        • createInvoicedOneTimeCharge
        • createOrder
        • createOrderedProduct
        • createOrderedProductV2
        • createProduct
        • createPromotion
        • createReturnOrder
        • createSelfServiceCenterLoginToken
        • createSelfServiceCenterLoginTokenV2
        • createServiceChannel
        • createSubscription
        • createSubscriptionFromCart
        • creditAndRefundInvoice
        • deactivateAppliedPromotion
        • destroyInvoiceLineItem
        • destroyOrderedProduct
        • editPlan
        • fulfillOrder
        • fulfillOrders
        • importSubscription
        • pauseSubscription
        • refundPayment
        • resumeSubscription
        • sendSelfServiceCenterLoginTokenEmail
        • shipOrderedProducts
        • switchSubscriptionPlan
        • syncShopifyProducts
        • unassignAsset
        • undoSubscriptionCancellation
        • updateAddressDetails
        • updateAppliedPromotion
        • updateAsset
        • updateAssetOwnership
        • updateInvoice
        • updateInvoiceLineItem
        • updateOrder
        • updateOrderedProduct
        • updateOrderedProductQuantity
        • updatePlan
        • updateProduct
        • updatePromotion
        • updateReturnOrder
        • updateShippingCostsExemption
        • updateSubscribedPlan
        • updateSubscription
      • Objects
        • AcceptanceCheck
        • AcceptanceCheckStatus
        • ActivateSubscriptionInput
        • ActivateSubscriptionPayload
        • AdyenPaymentMethodVariant
        • AppliedBillingCyclePromotion
        • AppliedOrderDiscountPromotion
        • AppliedPromotion
        • AppliedPromotionDeactivationStrategy
        • ApplyPromotionToSubscriptionInput
        • ApplyPromotionToSubscriptionPayload
        • Asset
        • AssetConnection
        • AssetCustomField
        • AssetCustomFieldInput
        • AssetCustomFieldValue
        • AssetEdge
        • AssetOwnership
        • AssetStatus
        • AssignAssetInput
        • AssignAssetPayload
        • BaseIntervalUnit
        • BillingCycleIntervalUnit
        • BillingCyclePromotion
        • Boolean
        • CancelReturnOrderInput
        • CancelReturnOrderPayload
        • CancelSubscriptionInput
        • CancelSubscriptionPayload
        • Cart
        • CollectionCase
        • CollectionCaseConnection
        • CollectionCaseEdge
        • CollectionCaseStatus
        • CommitmentUnit
        • CompleteReturnOrderInput
        • CompleteReturnOrderPayload
        • CompleteSubscriptionCancellationInput
        • CompleteSubscriptionCancellationPayload
        • CreateAssetInput
        • CreateAssetPayload
        • CreateCartInput
        • CreateCartPayload
        • CreateDiscountCodeInput
        • CreateDiscountCodePayload
        • CreateInvoiceLineItemInput
        • CreateInvoiceLineItemPayload
        • CreateInvoicedOneTimeChargeInput
        • CreateInvoicedOneTimeChargePayload
        • CreateOrderInput
        • CreateOrderPayload
        • CreateOrderedProductInput
        • CreateOrderedProductPayload
        • CreateOrderedProductV2Input
        • CreateOrderedProductV2Payload
        • CreateProductInput
        • CreateProductPayload
        • CreatePromotionInput
        • CreatePromotionPayload
        • CreateReturnOrderInput
        • CreateReturnOrderPayload
        • CreateSelfServiceCenterLoginTokenInput
        • CreateSelfServiceCenterLoginTokenPayload
        • CreateSelfServiceCenterLoginTokenV2Input
        • CreateSelfServiceCenterLoginTokenV2Payload
        • CreateServiceChannelInput
        • CreateServiceChannelPayload
        • CreateSubscriptionFromCartInput
        • CreateSubscriptionFromCartPayload
        • CreateSubscriptionInput
        • CreateSubscriptionPayload
        • CreditAndRefundInvoiceInput
        • CreditAndRefundInvoicePayload
        • CustomerFeedback
        • DeactivateAppliedPromotionInput
        • DeactivateAppliedPromotionPayload
        • DestroyInvoiceLineItemInput
        • DestroyInvoiceLineItemPayload
        • DestroyOrderedProductInput
        • DestroyOrderedProductPayload
        • DiscountCode
        • DiscountCodeConnection
        • DiscountCodeEdge
        • EditPlanInput
        • EditPlanPayload
        • ExtraField
        • ExtraFieldAnswer
        • ExtraFieldInput
        • ExtraFieldInterface
        • FeedbackTypeEnum
        • Float
        • FulfillOrderInput
        • FulfillOrderPayload
        • FulfillOrdersInput
        • FulfillOrdersPayload
        • ID
        • ISO8601Date
        • ISO8601DateTime
        • ImportSubscriptionInput
        • ImportSubscriptionPayload
        • InstalmentIntervalInterface
        • Int
        • Invoice
        • InvoiceConnection
        • InvoiceEdge
        • InvoiceLineItem
        • InvoiceReminder
        • InvoiceStatusEnum
        • InvoiceUpdatableStatusEnum
        • JSON
        • Licence
        • LineItemTypeEnum
        • MaximumCommitmentUnit
        • MetadataInterface
        • ModelValidationError
        • Offer
        • OfferTypeEnum
        • Order
        • OrderCalculation
        • OrderConnection
        • OrderDiscountPromotion
        • OrderEdge
        • OrderLine
        • OrderSortEnum
        • OrderStatus
        • OrderedProduct
        • OrderedProductEdge
        • OrderedProductInput
        • OrderedProductIntervalUnitOfMeasure
        • OrderedProductStatus
        • OrderedProductTypes
        • OrderedProductsWithSummaryConnection
        • PageInfo
        • PauseSubscriptionInput
        • PauseSubscriptionPayload
        • Payment
        • PaymentConnection
        • PaymentEdge
        • PaymentStatusEnum
        • PaymentTypeEnum
        • Plan
        • PlanConnection
        • PlanEdge
        • PlanProduct
        • Price
        • PriceDeleteInput
        • PriceInput
        • Product
        • ProductConnection
        • ProductEdge
        • Project
        • Promotion
        • Refund
        • RefundPaymentInput
        • RefundPaymentPayload
        • RefundStatus
        • ResumeSubscriptionInput
        • ResumeSubscriptionPayload
        • ReturnOrder
        • ReturnOrderConnection
        • ReturnOrderEdge
        • ReturnOrderProduct
        • ReturnOrderProductInput
        • ReturnOrderStatus
        • SelfServiceCenterLoginToken
        • SendSelfServiceCenterLoginTokenEmailInput
        • SendSelfServiceCenterLoginTokenEmailPayload
        • ServiceChannel
        • ShipOrderedProductsInput
        • ShipOrderedProductsPayload
        • String
        • SubscribedPlan
        • Subscription
        • SubscriptionAcceptanceCheck
        • SubscriptionAcceptanceCheckConnection
        • SubscriptionAcceptanceCheckEdge
        • SubscriptionAccount
        • SubscriptionAccountConnection
        • SubscriptionAccountEdge
        • SubscriptionAccountStatus
        • SubscriptionConnection
        • SubscriptionEdge
        • SubscriptionIdentity
        • SubscriptionStatus
        • SwitchSubscriptionPlanInput
        • SwitchSubscriptionPlanPayload
        • SyncShopifyProductsInput
        • SyncShopifyProductsPayload
        • TaxRate
        • UnassignAssetInput
        • UnassignAssetPayload
        • UndoSubscriptionCancellationInput
        • UndoSubscriptionCancellationPayload
        • UpdateAddressDetailsInput
        • UpdateAddressDetailsPayload
        • UpdateAppliedPromotionInput
        • UpdateAppliedPromotionPayload
        • UpdateAssetInput
        • UpdateAssetOwnershipInput
        • UpdateAssetOwnershipPayload
        • UpdateAssetPayload
        • UpdateInvoiceInput
        • UpdateInvoiceLineItemInput
        • UpdateInvoiceLineItemPayload
        • UpdateInvoicePayload
        • UpdateOrderInput
        • UpdateOrderPayload
        • UpdateOrderedProductInput
        • UpdateOrderedProductPayload
        • UpdateOrderedProductQuantityInput
        • UpdateOrderedProductQuantityPayload
        • UpdatePlanInput
        • UpdatePlanPayload
        • UpdateProductInput
        • UpdateProductPayload
        • UpdatePromotionInput
        • UpdatePromotionPayload
        • UpdateReturnOrderInput
        • UpdateReturnOrderPayload
        • UpdateShippingCostsExemptionInput
        • UpdateShippingCostsExemptionPayload
        • UpdateSubscribedPlanInput
        • UpdateSubscribedPlanPayload
        • UpdateSubscriptionInput
        • UpdateSubscriptionPayload
  • Liquid
    • Introduction
    • Email template overview
    • Using Extra Fields in Liquid
    • Available tags
  • Webhooks
    • Overview
  • Guides
    • Creating a Storefront App
    • Updating the amount of discount on each order
    • Build a switch/upgrade plan flow that requires payment
  • SDKs
    • Storefront JS SDK
      • Configuration Options
      • Create a Storefront API token
      • Shopify
        • Add an integrated cart to your Shopify store
        • Link up "View Cart" button
      • Translations and custom copy
      • Using with Next.js
    • Firmhouse SDK
      • Getting Started
      • Examples and Boilerplates
      • Handling Errors
      • Reference
        • Classes
          • FirmhouseClient
        • Resources
          • CartsResource
          • InvoicesResource
          • PlansResource
          • ProductsResource
          • ProjectsResource
          • SelfServiceCenterTokenResource
          • SubscriptionsResource
        • Errors
          • NotFoundError
          • ServerError
          • ValidationError
        • Enumerations
          • AcceptanceCheckStatus
          • Access
          • AppliedPromotionDeactivationStrategy
          • AssetStatus
          • BaseIntervalUnit
          • BillingCycleIntervalUnit
          • CollectionCaseStatus
          • CommitmentUnit
          • FeedbackTypeEnum
          • InvoiceStatusEnum
          • LineItemTypeEnum
          • MaximumCommitmentUnit
          • OrderStatus
          • OrderedProductIntervalUnitOfMeasure
          • OrderedProductStatus
          • OrderedProductTypes
          • PaymentStatusEnum
          • PaymentTypeEnum
          • RefundStatus
          • ReturnOrderStatus
          • SubscriptionStatus
        • Functions
          • mapExtraFieldsByFieldId()
        • Interfaces
          • FirmhouseAppliedOrderDiscountPromotion
          • FirmhouseAppliedPromotion
          • FirmhouseBillingCyclePromotion
          • FirmhouseCart
          • FirmhouseCollectionCase
          • FirmhouseConfig
          • FirmhouseDiscountCode
          • FirmhouseExtraField
          • FirmhouseExtraFieldAnswer
          • FirmhouseInvoice
          • FirmhouseInvoiceLineItem
          • FirmhouseInvoiceReminder
          • FirmhouseOrder
          • FirmhouseOrderLine
          • FirmhouseOrderedProduct
          • FirmhouseOrderedProductUtils
          • FirmhouseOrderedProductWithUtils
          • FirmhouseOriginalInvoice
          • FirmhousePayment
          • FirmhousePlan
          • FirmhouseProduct
          • FirmhouseProject
          • FirmhousePromotion
          • FirmhouseRefund
          • FirmhouseSubscribedPlan
          • FirmhouseSubscription
          • FirmhouseSubscriptionUtils
          • FirmhouseSubscriptionWithUtils
          • FirmhouseTaxRate
          • FirmhouseVerifiedIdentity
          • FirmouseCollectionCase
        • TypeAliases
          • PaginatedResponse
    • Headless React
      • Examples
      • Components
        • FirmhouseCartProvider
        • CheckoutForm
        • OrderedProductList
        • OrderSummary
        • Translated
Powered by GitBook
On this page
  • Props
  • Example

Was this helpful?

  1. SDKs
  2. Headless React
  3. Components

FirmhouseCartProvider

Props

apiToken string

The storefront access token that you can get from the Firmhouse Portal.

cartToken string?

The cart token that you can get from the Firmhouse SDK. This prop is optional, if you don't provide both cartToken and initialFirmhouseCart the cart will be initialized with an empty cart.

paymentPageUrl string?

The URL of the payment page where the user will be redirected if the payment is failed.

paymentSuccessPageUrl string?

The URL of the payment success page where the user will be redirected if the payment is successful.

locale string?

The locale of the user. This prop is optional, and it defaults to default locale for the country.

fallback React.ReactNode?

A fallback component that is shown while the data is loading. This prop is optional, and it defaults to null.

availableCountries string[]?

An array of country codes that will be available for the user to select. This prop is optional, and it defaults to ['NL', 'DE', 'BE', 'LU', 'AT', 'CH'].

translations Record<string, Record<string, NestedTranslations>>?

Example:

const translations = {
   en: {
    checkout: {
      title: "Checkout",
      fields: {
        termsAccepted: {
          label: "I accept the terms and conditions",
        },
      },
    },
  },
  nl: {
    checkout: {
      title: "Afrekenen",
      fields: {
        termsAccepted: {
          label: "Ik accepteer de algemene voorwaarden",
        },
        email: {
          label: "Emailadres",
          placeholder: "Emailadres",
        },
      },
    },
  }
}

The initial cart object that you can get from the Firmhouse SDK. If you would like to initialize the cart based on the data that you have, you can provide this prop. This prop is optional, and it defaults to null.

Example

<FirmhouseCartProvider 
    apiToken={apiToken} 
    cartToken={cartToken} 
    locale={locale ?? 'en'}
    fallback={<div>Loading...</div>}
    availableCountries={["BE", "NL"]}
    translations={translations}
  >
    <CheckoutForm fields={fields} inputClassName="input" />
  </FirmhouseCartProvider>;

Last updated 9 months ago

Was this helpful?

An object that contains translations for the components. This prop is optional, and it defaults to an empty object. You can check the default translations in the file. These translations are used to translate the text in the components. You can also use the Translated component to provide translations for your components.

initialFirmhouseCart | null

src/translations.ts
FirmhouseCart