詐欺防範信號
Google 可在傳送 SubmitOrderRequest
時提供更多使用者用戶端資訊。您可以使用這項資訊來防範整合作業中的詐欺交易。
如何讀取詐欺防範信號
在專案啟用接收其他詐欺防範信號時,SubmitOrderRequest
標頭會包含使用者用戶端的相關資訊,而非 Google 伺服器的資訊。要求標頭將包含以下資訊:
IP 位址:
x-forwarded-for
欄位中的「第一個 IP」可做為使用者用戶端的 IP 位址。此位址的格式為 IPV4 或 IPV6 格式,取決於使用者用戶端的設定。使用者代理程式:使用者代理程式字串會儲存在
user-agent
欄位中,後置字串為「Google-ActionsOnGoogle/1.0」。請注意,這個欄位可能不會填入使用者的裝置,具體取決於使用者的裝置,以及他們是否透過語音下單。
以下是啟用詐欺防範時的 SubmitOrderRequest
HTTP 標頭程式碼片段:
X-Forwarded-For: 72.00.123.12,66.111.12.123, 169.254.1.1 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36,gzip(gfe),gzip(gfe) Google-ActionsOnGoogle/1.0
如果使用者用戶端資訊不足以執行詐欺防範,請洽詢您的 Google 聯絡人以討論替代解決方案。
如何處理履行中的詐欺交易
根據使用者在 SubmitOrderRequest
中提供的 IP 位址和使用者代理程式資訊,使用內部詐欺防範演算法判斷交易是否合理。
如果交易疑似詐欺,請回應 REJECTED
的 orderState
和 INELIGIBLE
的 rejectionInfo
,並在 SubmitOrderResponseMessage
中適當提供錯誤說明。
如果您發現交易的正當性,請照常處理訂單。
帳單地址驗證
為減少詐欺,您可以在向 PSP 的付款交易要求中加入帳單地址。SubmitOrderRequestMessage
中會傳回 billingAddress。
- 將結帳回應的 CardParameters.billingAddressRequired 設為
true
,要求使用者輸入帳單地址。 - 設定 CardParameters.billingAddressParameters,定義必填欄位。建議您設定
{"format":"MIN"}
,減少使用者的不便。 - 請納入完整的 billingAddress 或 billingAddress.postalCode,以便在與 PSP 的付款交易中進行驗證。
googleProvidedPaymentOptions 範例:
{ "facilitationSpecification": "{\"apiVersion\":2,\"apiVersionMinor\":0,\"merchantInfo\":{\"merchantId\":\"Merchant ID\",\"merchantName\":\"Merchant Name\"},\"allowedPaymentMethods\":[{\"type\":\"CARD\",\"parameters\":{\"allowedAuthMethods\":[\"PAN_ONLY\"],\"allowedCardNetworks\":[\"VISA\",\"AMEX\",\"MASTERCARD\"],\"billingAddressRequired\":true,\"billingAddressParameters\":{\"format\":\"MIN\"}},\"tokenizationSpecification\":{\"type\":\"PAYMENT_GATEWAY\",\"parameters\":{\"gateway\":\"stripev2\",\"gatewayMerchantId\":\"stripe_pk_live_key\"}}}]}" }
如果 PSP 回覆地址或郵遞區號不正確,您應傳回類似的範例 SubmitOrderResponseMessage
回應。
回應範例
{ "expectUserResponse": false, "finalResponse": { "richResponse": { "items": [ { "structuredResponse": { "orderUpdate": { "actionOrderId": "sample_action_order_id", "orderState": { "state": "REJECTED", "label": "Order rejected" }, "updateTime": "2017-05-10T02:30:00.000Z", "rejectionInfo": { "type": "PAYMENT_DECLINED", "reason": "Invalid zipcode" }, "orderManagementActions": [ { "type": "CUSTOMER_SERVICE", "button": { "title": "Contact customer service", "openUrlAction": { "url": "mailto:support@example.com" } } }, { "type": "EMAIL", "button": { "title": "Email restaurant", "openUrlAction": { "url": "mailto:person@example.com" } } }, { "type": "CALL", "button": { "title": "Call restaurant", "openUrlAction": { "url": "tel:+16505554679" } } }, { "type": "VIEW_DETAILS", "button": { "title": "View order", "openUrlAction": { "url": "https://orderview.partner.com?orderid=sample_action_order_id" } } } ] } } } ] } } }
傳回 PAYMENT_DECLINED
rejectionInfo 類型會顯示訊息,並讓使用者更新帳單地址或選擇其他付款方式。「提交訂單錯誤快訊」已排除 PAYMENT_DECLINED
錯誤。