The API for interacting with the note applied to checkout.
The base API object provided to `purchase` extension targets.
A note left by the customer to the merchant, either in their cart or during checkout.
Returns the proposed `note` applied to the checkout.
Returns the proposed `note` applied to the checkout.
export function useNote< Target extends RenderExtensionTarget = RenderExtensionTarget, >(): string | undefined { return useSubscription(useApi<Target>().note); }
The API object provided to `purchase.checkout` extension targets.
Performs an update on the note attached to the cart and checkout. If successful, this mutation results in an update to the value retrieved through the [`note`](/docs/api/checkout-ui-extensions/apis/note#standardapi-propertydetail-note) property. > Note: This method will return an error if the [cart instruction](/docs/api/checkout-ui-extensions/apis/cart-instructions#standardapi-propertydetail-instructions) `notes.canUpdateNote` is false, or the buyer is using an accelerated checkout method, such as Apple Pay, Google Pay, or Meta Pay.
NoteRemoveChange | NoteUpdateChange
Removes a note
The type of the `NoteRemoveChange` API.
An Update to a note on the order. for example, the buyer could request detailed packaging instructions in an order note
The new value of the note.
The type of the `NoteUpdateChange` API.
NoteChangeResultSuccess | NoteChangeResultError
The type of the `NoteChangeResultSuccess` API.
A message that explains the error. This message is useful for debugging. It is **not** localized, and therefore should not be presented directly to the buyer.
The type of the `NoteChangeResultError` API.
Returns a function to mutate the `note` property of the checkout.
Returns a function to mutate the `note` property of the checkout.
export function useApplyNoteChange< Target extends RenderExtensionTarget = RenderExtensionTarget, >(): (change: NoteChange) => Promise<NoteChangeResult> { const api = useApi<Target>(); if ('applyNoteChange' in api) { return api.applyNoteChange; } throw new ExtensionHasNoMethodError('applyNoteChange', api.extension.target); }
NoteRemoveChange | NoteUpdateChange
Removes a note
The type of the `NoteRemoveChange` API.
An Update to a note on the order. for example, the buyer could request detailed packaging instructions in an order note
The new value of the note.
The type of the `NoteUpdateChange` API.
NoteChangeResultSuccess | NoteChangeResultError
The type of the `NoteChangeResultSuccess` API.
A message that explains the error. This message is useful for debugging. It is **not** localized, and therefore should not be presented directly to the buyer.
The type of the `NoteChangeResultError` API.