防範詐欺行為

詐欺防範信號

Google 在傳送 SubmitOrderRequest 時,可以提供額外的使用者用戶端資訊。您可以利用這項資訊,防止整合作業中發生詐欺交易。

如何解讀防範詐欺信號

當專案啟用接收額外防詐欺信號時,SubmitOrderRequest 標頭會包含使用者用戶端的資訊,而非 Google 伺服器。要求標頭會包含以下資訊:

  • IP 位址:使用者用戶端的 IP 位址可做為 x-forwarded-for 欄位中的第一個 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 位址和使用者代理程式資訊,使用內部防詐騙演算法判斷交易是否合法。

如果交易似乎涉及詐欺行為,請在 SubmitOrderResponseMessage 中回應 REJECTEDorderStateINELIGIBLErejectionInfo,並附上適當的錯誤說明。

如果交易似乎合法,請照常處理訂單。

帳單地址驗證

為減少詐欺行為,您可以在付款交易要求中加入帳單地址,以便提供給 PSP。billingAddress 會以 SubmitOrderRequestMessage 傳回。

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 錯誤。