1
傳送已驗證的客戶資訊
要驗證客戶檔案,您的後端伺服器必須進行兩個獨立的 API 呼叫,我們建議平行執行以改善效能:
-
createCart:產生 Zonos 購物車。如需詳細指導,請參閱自訂整合文件中的設定 Zonos Checkout 部分。 -
checkoutCustomerProfileAuthenticate:提交並驗證客戶的資訊。
1
mutation checkoutCustomerProfileAuthenticate(2
$input: CheckoutCustomerProfileAuthenticateInput!3
) {4
checkoutCustomerProfileAuthenticate(input: $input) {5
email6
customerId7
organizationId8
name9
phone10
locations {11
administrativeArea12
countryCode13
locality14
line115
line216
postalCode17
}18
oneTimePassword19
}20
}驗證客戶工作階段時,請確保您在請求中傳遞的 customerId 符合正確的檔案,以在結帳時顯示準確的客戶資訊。請記住,建立購物車時,不應在中繼資料中包含 customerId,因為它會被覆蓋。
客戶通過驗證且下訂單後,customerId 將可透過訂單查詢取得訂單詳細資訊時的 order.references 中取得,讓您能夠將訂單與正確的客戶相關聯。
2
使用客戶檔案建立購物車
呼叫兩個變異後,您將獲得以下內容:
-
來自
createCart變異的cartId以產生購物車。 -
來自
checkoutCustomerProfileAuthenticate變異的oneTimePassword以進行客戶驗證。
您可以在 Zonos.init 函數中的 createCartId 回呼中傳遞這兩個值,以在 Checkout 中載入提供的客戶檔案資訊。
1
Zonos.init({2
...3
checkoutSettings: {4
...5
createCartId: async () => {6
const result = await fetch(7
'https://api.merchant.com/api/get-cart-info',8
{9
body: JSON.stringify(payload),10
method: 'POST',11
},12
);13
const json =14
await result.json();15
return {16
cartId: json.cartId,17
customerAuthenticationToken:18
json.customerProfileAuthenticate19
?.checkoutCustomerProfileAuthenticate.oneTimePassword ||20
'',21
};22
}23
},24
}3
管理客戶檔案
您第一次提交客戶資訊時,Zonos 將儲存提供的客戶資訊。付款方式將安全地儲存在 Stripe 中。每次傳遞新的地址或付款方式詳細資訊時,都會將其新增至客戶的檔案。
目前,客戶檔案只能使用額外資訊進行更新,無法編輯或移除現有詳細資訊。
客戶檔案
將重複購物者資訊預先載入至 Zonos Checkout。客戶檔案可透過允許擁有帳戶的客戶預先載入其地址和付款詳細資訊,來簡化您的結帳體驗。
此功能目前僅適用於自訂 API 整合。使用 Checkout 外掛程式的商家尚無法使用此功能。