JSON 回應物件

本參考資料介紹可用於應用程式的 Google Pay API 回應物件選項。回應物件為 Google Pay API 用戶端方法傳回的物件。

PaymentData

這是付款人核准付款後,由 Google 傳回的回應物件。

PaymentDataRequest.PaymentDataRequest.PaymentDataRequest
屬性 類型 永遠存在 說明
apiVersion number 主要 API 版本。回應中的值與您在
apiVersionMinor 數字 次要 API 版本。回應中的值與您在
paymentMethodData PaymentMethodData 所選付款方式的相關資料。
email string 電子郵件地址 (如果 PaymentDataRequest。如有其他要求將這項屬性設定為 true,則不具任何效力。
shippingAddress 地址 shippingAddressRequired 設為 true 時的運送地址 (位在

範例

這個 Google Pay API 版本 2.0 回應範例顯示 Google Pay 付款畫面中選取的 CARD 付款方式。我們已為 example 閘道產生付款方式代碼。

{
  "apiVersion": 2,
  "apiVersionMinor": 0,
  "paymentMethodData": {
    "type": "CARD",
    "description": "Visa •••• 1234",
    "info": {
      "cardNetwork": "VISA",
      "cardDetails": "1234",
      "cardFundingSource": "CREDIT"
    },
    "tokenizationData": {
      "type": "PAYMENT_GATEWAY",
      "token": "examplePaymentMethodToken"
    }
  }
}

PaymentMethodData

這個物件提供所選付款方式的資料。

屬性 類型 永遠存在 說明
type string PaymentMethod 在 Google Pay 付款畫面中選取了 type
description 字串

向使用者顯示的訊息,用於說明這項交易使用的付款方式。

info object 這項屬性的值會因傳回的付款方式 type 而異。如為 CARD,請參閱 CardInfo
tokenizationData PaymentMethodTokenizationData 所選付款方式的付款代碼化資料。

範例

這個回應範例顯示了使用者在 Google Pay 付款畫面中選取 CARD 付款方式之後,系統如何為 example 閘道產生付款方式代碼。

{
  "type": "CARD",
  "description": "Visa •••• 1234",
  "info": {
    "cardNetwork": "VISA",
    "cardDetails": "1234"
  },
  "tokenizationData": {
    "type": "PAYMENT_GATEWAY",
    "token": "examplePaymentMethodToken"
  }
}

CardInfo

這個物件提供所選付款卡的相關資訊。

屬性 類型 永遠存在 說明
cardDetails string 卡片詳細資料。這個值通常為所選付款帳號的末四碼。
assuranceDetails AssuranceDetailsSpecifications 如果 CardParameters
cardNetwork 字串

所選款項的付款卡發卡機構。傳回的值與 allowedCardNetworks 格式相符,後者 CardParameters

這個發卡機構值不應向買家顯示。在必須提供買家詳細資料時,您可以使用這個值 舉例來說,如果客戶服務需要這個值來識別買家用於交易的卡片。如要向使用者顯示相關說明,請改用 PaymentMethodDatadescription 屬性。

billingAddress 地址 billingAddressRequired 設為 true時,與所提供付款方式相關聯的帳單地址。該屬性 CardParameters
cardFundingSource 字串

所選付款方式的卡片資金來源。

  • UNKNOWN
  • CREDIT
  • DEBIT
  • PREPAID

範例

這個範例顯示 Visa 發卡機構的卡片。

{
  "cardNetwork": "VISA",
  "cardDetails": "1234",
  "cardFundingSource": "CREDIT",
  "assuranceDetails": {
    "cardHolderAuthenticated": false,
    "accountVerified": true
  }
}

AssuranceDetailsSpecifications

這個物件會提供相關資訊,說明系統對傳回的付款憑證執行的驗證作業,以便套用合適的付款方式風險檢查程序。

姓名 類型 說明
accountVerified 布林值 如為 true,代表系統已對傳回的付款憑證執行Cardholder擁有權驗證。
cardHolderAuthenticated 布林值

如為 true,代表系統已對傳回的付款憑證執行身分識別與驗證 (ID&V)。

如為 false,則可執行與卡片交易相同的風險相關驗證。這項風險相關驗證可包括但不限於:在適用情況下,使用 3D Secure 協議進行進階程序。

即使不使用 assuranceDetails 欄位,您也可以接收及處理回應物件。如要接收這個物件,請在要求物件的 CardParameters

PaymentMethodTokenizationData

這個物件提供付款方式的代碼化資料。

屬性 類型 永遠存在 說明
type string 要套用至所選付款方式的代碼化類型。這個值與 type 相符,該屬性是在 PaymentMethodTokenizationSpecification
token 字串

產生的付款方式代碼。

範例

這是針對 example 閘道準備的代碼化回應範例。

{
  "type": "PAYMENT_GATEWAY",
  "token": "examplePaymentMethodToken"
}

地址

這個物件提供有關所要求郵寄地址的資訊。所有屬性皆為字串。

地址可以 MINFULLFULL-ISO3166 格式傳回。下表列出各格式的屬性。

屬性 地址格式 說明
name MINFULLFULL-ISO3166 收件人的全名。
postalCode MINFULLFULL-ISO3166 郵遞區號。
countryCode MINFULLFULL-ISO3166 ISO 3166-1 alpha-2 國家/地區代碼。
phoneNumber MINFULLFULL-ISO3166 電話號碼 (如果 PaymentDataRequest
address1 FULLFULL-ISO3166 地址的第一行。
address2 FULLFULL-ISO3166 地址的第二行。
address3 FULLFULL-ISO3166 地址的第三行。
locality FULLFULL-ISO3166 市、鎮、鄰或郊區。
administrativeArea FULLFULL-ISO3166 行政區 (例如州或省)。
sortingCode FULLFULL-ISO3166 郵政編碼。
iso3166AdministrativeArea FULL-ISO3166 與 administrativeArea 相對應的 ISO 3166-2 行政區代碼。

範例

下列範例顯示了含有多行街道地址資料的美國 FULL-ISO3166 格式地址。

{
  "name": "John Doe",
  "address1": "c/o Google LLC",
  "address2": "1600 Amphitheatre Pkwy",
  "address3": "Building 40",
  "locality": "Mountain View",
  "administrativeArea": "CA",
  "countryCode": "US",
  "postalCode": "94043",
  "sortingCode": ""
  "iso3166AdministrativeArea": "US-CA"
}