Post-purchase extension points API
Post-purchase checkout extensions allow developers and Plus merchants to add a post-purchase page directly into the Shopify checkout.
The page appears after the order is confirmed, but before the Order status page.
Post-purchase checkout extensions can use the ShouldRender and Render extension points.
For more information, refer to the post-purchase checkout extensions overview .
Name Type Description Checkout::PostPurchase::Render RenderExtension <PostPurchaseRenderApi < Imported >, AllComponents >The Render extension point is used to render the section in the post-purchase page. Also, it provides additional functionality, such as communicating with Shopify to add items to the initial purchase. Checkout::PostPurchase::ShouldRender (api: PostPurchaseShouldRenderApi < Imported >) => PostPurchaseShouldRenderResult< Imported >The ShouldRender extension point is used to determine whether a post-purchase page should be shown to the customer. It also allows data to be pre-cached and used when the page renders.
Input given to the ShouldRender extension point (Checkout::PostPurchase::ShouldRender).
Name Type Description inputData InputData Input data given to the extension point. storage Storage General purpose storage for extensions.
A type of extension point that is capable of rendering UI into Checkout
natively. This type of extension point receives an object to manipulate
the UI as its first argument, and additional data and methods as a second
argument. The object that can manipulate the UI is referred to as a RemoteRoot,
and is provided by the remote-ui library
on which UI Extensions' rendering capabilities are built.
Type Description (root: RemoteRoot< AllowedComponents, true >, input: Input): RenderResult < Input > | voidInput type for RenderExtension.
The output expected from the ShouldRender extension point.
Name Type Description update? (input: Partial< Input< Autocomplete >>) => voidWhether the post-purchase page is requested.
Input given to the render extension point (Checkout::PostPurchase::Render).
Name Type Description inputData InputData Input data given to the extension point. storage Storage General purpose storage for extensions. calculateChangeset (changeset: Readonly<Changeset > | string) => Promise<CalculateChangesetUnprocessedResult | CalculateChangesetProcessedResult >Returns the calculations that would result from the provided changeset being applied. Used to provide cost-clarity for buyers. applyChangeset (changeset: string, options: ApplyChangesetOptions < >) => Promise<ApplyChangesetResult >Requests a changeset to be applied to the initial purchase, and to charge the buyer with the difference in total price, if any. done () => Promise< void >Indicates that the extension has finished running. Redirects customers to the Order status page.
Requests a changeset to be applied to the initial purchase,
and to charge the buyer with the difference in total price if any.
Name Type Description errors ChangesetError []Represents an error occurred while calculating or applying a changeset. status "processed" | "partially_processed" | "unprocessed"An enum representing the result of attempting to apply or calculate a changeset. changesetApplicationsRemaining numberHow many changesets can still be applied to the initial purchase.
Name Type Description buyerConsentToSubscriptions? boolean
Returns a CalculatedPurchase for processed changeset.
Name Type Description errors ChangesetError []Empty array of errors. status "processed"Always returns processed. calculatedPurchase CalculatedPurchase Returns CalculatedPurchase.
Represents the updated state of the initial purchase.
Name Type Description subtotalPriceSet MoneyBag < >Updated total price of the purchase with discounts but before shipping, taxes, and tips. totalPriceSet MoneyBag < >Updated final price of the purchase. addedTaxLines AddedTaxLine []Array of AddedTaxLine. updatedLineItems UpdatedLineItem []Array of UpdatedLineItem. addedShippingLines AddedShippingLine []Array of AddedShippingLine. totalOutstandingSet MoneyBag < >The amount left unpaid after the update.
Represents a shipping line that was added after a changeset was calculated.
Name Type Description priceSet MoneyBag < >The shipping line price. presentmentTitle stringThe customer facing line title.
Represents the updated state of a line item after a changeset has been calculated including any added line items.
Name Type Description totalPriceSet MoneyBag < >The discounted total price. priceSet MoneyBag < >The price per quantity productId numberThe product ID. variantId numberThe variant ID. sellingPlanId? numberThe selling plan ID. productHandle stringThe product slug in kebab-case. quantity numberHow many items are being purchased in this line.
Represents the information about the tax charged on the associated line item.
Name Type Description priceSet MoneyBag < >The tax amount. rate numberThe tax rate to be applied. title stringThe name of the tax.
Returns an array of ChangesetError, when the changeset can't be processed.
Name Type Description errors ChangesetError []Array of errors. status "unprocessed"Always returns unprocessed. calculatedPurchase? neverNot returned for unprocessed result.
Represents an error occurred while calculating or applying a changeset.
Name Type Description code "payment_required" | "insufficient_inventory" | "changeset_already_applied" | "unsupported_payment_method" | "invalid_request" | "server_error" | "buyer_consent_required" | "subscription_vaulting_error" | "subscription_contract_creation_error" | "subscription_no_shipping_address_error" | "subscription_limit_error" | "order_released_error"An error code corresponding to an error that occurred while calculating or applying a changeset. Useful for grouping errors that can be handled similarily. message stringThe error description.
A list of requested changes to be made to the initial purchase.
Requests a subscription to be added to the initial purchase.
Name Type Description type "add_subscription"A fixed value of "add_subscription". variantId numberThe product variant to add. sellingPlanId numberThe selling plan to apply. initialShippingPrice numberThe shipping line price without taxes for the first shipping cycle. recurringShippingPrice numberThe shipping line price without taxes for the recurring shipping cycles. quantity numberThe quantity of the specified variant. shippingOption ShippingOption Additional information concerning shipping. discount? ExplicitDiscount Refer to ExplicitDiscount .
Name Type Description title? stringpresentmentTitle? string
Requests to set a metafield on the initial purchase.
If a metafield with the same namespace and key pair already exists, then its contents are replaced.
Name Type Description key stringThe metafield key. namespace stringThe metafield namespace. value string | numberThe metafield value. valueType "integer" | "string" | "json_string"The metafield value type. type "set_metafield"A fixed value of "set_metafield".
Requests a shipping line to be added to the initial purchase.
Name Type Description type "add_shipping_line"A fixed value of "add_shipping_line". price numberThe shipping line price without taxes. title? stringThe merchant-facing line title. presentmentTitle? stringThe buyer-facing line title.
Requests a variant to be added to the initial purchase.
Name Type Description type "add_variant"A fixed value of "add_variant". variantId numberThe product variant to add. quantity numberThe quantity of the specified variant. discount? ExplicitDiscount Refer to ExplicitDiscount .
Requests to attach an explicit discount to a compatible change.
Name Type Description value numberThe discount value. valueType "percentage" | "fixed_amount"The discount type. title stringThe reason for adding the discount.
General-purpose, key-value browser storage for extensions.
Name Type Description initialData unknownData in the storage during the first load (read-only). update (data: any) => Promise< void >Updates the storage to the value that it's given.
The data given as input to both extension points.
Name Type Description extensionPoint stringIdentifier for the extension point. initialPurchase Purchase Initial purchase. locale stringCheckout customer locale. shop Shop Shop where the checkout/order is from. token stringJWT representing the input_data payload. For more information, refer to JWT specification . version stringPost Purchase API version.
The shop where the extension is running.
Name Type Description id numberThe shop's unique identifier. domain stringThe primary domain of the shop (ending with “.myshopify.com”). metafields Metafield []Only public listed metafields are available.
Represents the initial purchase's state when the extension is loaded.
Name Type Description referenceId stringInitial purchase's unique identifier. customerId? stringThe unique identifier of the buyer. destinationCountryCode? stringThe unique identifier of the country for shipping. totalPriceSet MoneyBag The total price of the purchase, including shipping, taxes and discounts. lineItems LineItem []Items being purchased.
The items purchased.
Name Type Description product Product Product being purchased. quantity numberThe amount of items for the line. totalPriceSet MoneyBag < >The total price of the line item, with line discounts. sellingPlanId? numberThe selling plan's unique identifier
The product for purchase.
Name Type Description id numberThe product's unique identifier. title stringThe product title. variant Variant Variant being purchased. metafields Metafield < >[]Only public listed metafields are available.
The product variant for purchase.
Name Type Description id numberThe variant's unique identifier. title stringThe variant title. metafields Metafield < >[]Only public listed metafields are available.
The metafields associated with a resource.
You'll need to individually request which metafields you need in the configuration file .
Name Type Description key stringThe metafield key. namespace stringThe metafield namespace. value string | numberThe metafield value. valueType "integer" | "string" | "json_string"The metafield value type.
Represents an amount in both shop and presentment currencies.
Name Type Description shopMoney Money Amount in shop currency. presentmentMoney Money Amount in presentment currency.
A list of requested changes to be made to the initial purchase.
Name Type Description amount stringThe actual amount. currencyCode stringIn ISO 4217 format.
Was this page helpful? Yes No