trackPurchaseStatus
Ce contenu n’est pas encore disponible dans votre langue.
trackPurchaseStatus(
args):Promise<void>
Defined in: actions/trackPurchaseStatus.ts:34
Function used to track the status of a purchase
when a purchase is tracked, the purchaseCompleted interactions will be automatically send for the user when we receive the purchase confirmation via webhook.
Parameters
Section titled “Parameters”customerId
Section titled “customerId”string | number
The customer id that made the purchase (on your side)
merchantId?
Section titled “merchantId?”string
Optional explicit merchant id to use for the tracking request
orderId
Section titled “orderId”string | number
The order id of the purchase (on your side)
string
The token of the purchase
Returns
Section titled “Returns”Promise<void>
Description
Section titled “Description”This function will send a request to the backend to listen for the purchase status.
Example
Section titled “Example”async function trackPurchase(checkout) { const payload = { customerId: checkout.order.customer.id, orderId: checkout.order.id, token: checkout.token, merchantId: "your-merchant-id", };
await trackPurchaseStatus(payload);}Remarks
Section titled “Remarks”- Merchant id is resolved in this order: explicit
args.merchantId, thensdkConfigStore.resolveMerchantId()(config store → sessionStorage → backend fetch). - This function supports anonymous users and will use the
x-frak-client-idheader when available. - At least one identity source must exist (
frak-wallet-interaction-tokenorx-frak-client-id), otherwise the tracking request is skipped. - This function will print a warning if used in a non-browser environment or if no identity / merchant id can be resolved.