최신 버전으로 업데이트
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Google Pay API는 2018년 7월에 PaymentDataRequest
및 IsReadyToPayRequest
객체의 새로운 객체 구조를 도입했습니다. 이 가이드는 Google Pay API 버전 1용으로 형식이 지정된 객체를 버전 2용으로 업데이트하는 방법을 설명합니다.
결제 수단
API 버전은 Google Pay API 버전 2의 각 요청 객체와 함께 지정됩니다.
Google Pay API 버전 1은 카드를 유일한 결제 방법으로 지원했지만 CARD
결제 수단은 Google Pay API 버전 2에서 사용할 수 있는 여러 결제 수단 옵션 중 하나입니다. 이전에 CARD
의 allowedPaymentMethods
값을 지정한 사이트는 이제 PAN_ONLY
의 allowedAuthMethods
값을 설정해야 합니다. 이전에 TOKENIZED_CARD
의 allowedPaymentMethods
값을 지정한 사이트는 이제 CRYPTOGRAM_3DS
의 allowedAuthMethods
값을 설정해야 합니다.
사용 가능한 카드 네트워크는 해당 네트워크 카드에 지원되는 인증 방법과 함께 지정됩니다.
apiVersion 1
{
allowedPaymentMethods: [
'CARD',
'TOKENIZED_CARD'
],
cardRequirements: {
allowedCardNetworks: [
'AMEX',
'DISCOVER',
'JCB',
'MASTERCARD',
'VISA'
]
}
}
apiVersion 2
{
apiVersion: 2,
apiVersionMinor: 0,
allowedPaymentMethods: [{
type: 'CARD',
parameters: {
allowedAuthMethods: [
'PAN_ONLY',
'CRYPTOGRAM_3DS'
],
allowedCardNetworks: [
'AMEX',
'DISCOVER',
'JCB',
'MASTERCARD',
'VISA'
]
}
}]
}
허용된 카드 네트워크와 그 인증 방법은 CARD
결제 수단의 IsReadyToPayRequest
에 포함됩니다.
카드 결제 데이터 토큰화
Google Pay API는 지정된 게이트웨이가 참조하거나 서버에서 복호화하는 암호화된 카드 데이터를 반환합니다. Google Pay API 버전 2는 CARD
결제 수단 내부로 결제 수단 토큰화를 이동합니다.
apiVersion 1
{
paymentMethodTokenizationParameters: {
tokenizationType: 'PAYMENT_GATEWAY',
parameters: {
'gateway': 'example',
'gatewayMerchantId': 'exampleMerchantId'
}
}
}
apiVersion 2
{
allowedPaymentMethods: [{
type: 'CARD',
tokenizationSpecification: {
type: 'PAYMENT_GATEWAY',
parameters: {
'gateway': 'example',
'gatewayMerchantId': 'exampleMerchantId'
}
}
}]
}
Google 판매자 ID
Google Pay API 버전 1에서 Google 판매자 ID는 최상위 속성이었습니다. 하지만 Google 판매자 ID는 이제 선택사항인 판매자 이름과 함께 MerchantInfo
객체에 배치됩니다.
apiVersion 1
{
merchantId: '12345678901234567890'
}
apiVersion 2
{
merchantInfo: {
merchantId: '12345678901234567890'
}
}
청구서 수신 주소
선택사항인 청구서 수신 주소와 청구서 수신 전화번호는 CARD
결제 수단과 연결되어 있습니다.
사이트에서 청구서 수신 주소를 요청하면 예상 응답과 관련된 모든 구성이 BillingAddressParameters
객체에 배치됩니다.
apiVersion 1
{
cardRequirements: {
billingAddressRequired: true,
billingAddressFormat: 'FULL'
},
phoneNumberRequired: true
}
apiVersion 2
{
allowedPaymentMethods: [{
type: 'CARD',
parameters: {
billingAddressRequired: true,
billingAddressParameters: {
format: 'FULL',
phoneNumberRequired: true
}
}
}]
}
배송지 주소
선택사항인 배송지 주소 요구사항은 PaymentDataRequest
객체의 최상위에 남아 있고
shippingAddressRequirements
속성의 이름이 shippingAddressParameters
로 변경되었습니다.
이전 Google Pay API 응답은 전화번호를 요청할 때 배송지 주소의 일부로 전화번호를 반환했을 수 있지만 Google Pay API의 어떤 버전에서도 배송지 전화번호를 더 이상 지원하지 않습니다.
배송지 전화번호를 예상하는 응답 핸들러를 업데이트해야 합니다.
apiVersion 1
{
shippingAddressRequired: true,
shippingAddressRequirements: {
allowedCountryCodes: [
'US',
'CA'
]
}
}
apiVersion 2
{
shippingAddressRequired: true,
shippingAddressParameters: {
allowedCountryCodes: [
'US',
'CA'
]
}
}
PaymentData 응답
PaymentDataRequest
에서 2
의 apiVersion
속성 값을 설정하는 사이트의 PaymentData
객체 응답은 카드를 여러 가능한 결제 데이터 응답 중 하나로서 참조하도록 변경되었습니다.
PaymentDataRequest
객체에 포함된 apiVersion
및 apiVersionMinor
속성은 PaymentData
응답에 표시되어 예상 형식을 나타냅니다.
apiVersion 1
{
// no version specified
}
apiVersion 2
{
apiVersion: 2,
apiVersionMinor: 0
}
선택한 결제 수단 및 토큰화에 대한 정보는 paymentMethodData
속성에 배치됩니다.
카드 결제 수단의 cardInfo
객체에서 두 속성 cardClass
및 cardImageUri
가 삭제되었습니다.
apiVersion 1
{
cardInfo: {
cardDescription: 'Visa •••• 1234',
cardNetwork: 'VISA',
cardDetails: 1234
},
paymentMethodToken: {
tokenizationType: 'PAYMENT_GATEWAY',
token: 'examplePaymentMethodToken'
}
}
apiVersion 2
{
paymentMethodData: {
type: 'CARD',
description: 'Visa •••• 1234',
info: {
cardNetwork: 'VISA',
cardDetails: '1234'
},
tokenizationData: {
type: 'PAYMENT_GATEWAY',
token: 'examplePaymentMethodToken'
}
}
}
암호화된 메시지 응답
DIRECT
결제 수단 토큰화 유형을 지정하고 TOKENIZED_CARD
의 API 버전 1 결제 수단을 수락하는 사이트는 복호화된 encryptedMessage
속성을 처리하는 방식을 업데이트해야 합니다. 3D Secure 암호 및 선택적 전자 상거래 표시기(ECI)로 인증된 Android 기기 토큰을 게이트웨이 또는 대행업체로 계속 전달해야 하기 때문입니다. 카드는 paymentMethodDetails.authMethod
에서 선택한 카드의 인증 방법에 대한 추가 정보가 있는 CARD
의 paymentMethod
입니다.
apiVersion 1
{
"paymentMethod": "TOKENIZED_CARD",
"paymentMethodDetails": {
"authMethod": "3DS",
"dpan": "1111222233334444",
"expirationMonth": 10,
"expirationYear": 2020,
"3dsCryptogram": "AAAAAA...",
"3dsEciIndicator": "eci indicator"
}
}
apiVersion 2
{
"paymentMethod": "CARD",
"paymentMethodDetails": {
"authMethod": "CRYPTOGRAM_3DS",
"pan": "1111222233334444",
"expirationMonth": 10,
"expirationYear": 2020,
"cryptogram": "AAAAAA...",
"eciIndicator": "eci indicator"
}
}
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-10-16(UTC)
[null,null,["최종 업데이트: 2024-10-16(UTC)"],[[["\u003cp\u003eGoogle Pay API \u003ccode\u003ePaymentDataRequest\u003c/code\u003e and \u003ccode\u003eIsReadyToPayRequest\u003c/code\u003e objects have been updated with new structures in version 2, requiring updates to existing integrations.\u003c/p\u003e\n"],["\u003cp\u003eVersion 2 introduces explicit API versioning and expands payment methods beyond just cards, requiring adjustments to \u003ccode\u003eallowedPaymentMethods\u003c/code\u003e and \u003ccode\u003eallowedAuthMethods\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003ePayment method tokenization, Google merchant ID, billing address configuration, and shipping address parameters have been relocated within the new object structure.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ePaymentData\u003c/code\u003e response format has been revised to include API version information and nest card details within \u003ccode\u003epaymentMethodData\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eHandling of encrypted message responses for tokenized cards requires updates to accommodate the new \u003ccode\u003epaymentMethod\u003c/code\u003e and \u003ccode\u003epaymentMethodDetails\u003c/code\u003e structure.\u003c/p\u003e\n"]]],["The Google Pay API updated its object structures to version 2. Key changes include specifying the API version in each request and expanding payment methods beyond just `CARD`. Version 2 requires setting `allowedAuthMethods` to `PAN_ONLY` or `CRYPTOGRAM_3DS` instead of `allowedPaymentMethods`. Tokenization moved inside the `CARD` payment method, and the merchant ID is now within the `MerchantInfo` object. Billing and shipping address requirements are reorganized. Finally, `PaymentData` responses now specify the API version.\n"],null,["# Update to latest version\n\nThe Google Pay API introduced new object structures for\n[`PaymentDataRequest`](/pay/api/web/reference/request-objects#PaymentDataRequest) and\n[`IsReadyToPayRequest`](/pay/api/web/reference/request-objects#IsReadyToPayRequest) objects in July 2018. This guide explains how to update\nobjects formatted for Google Pay API version 1 to objects formatted for version 2.\n\nPayment methods\n---------------\n\nAn API version is specified with each request object in version 2 of the Google Pay API.\n\nVersion 1 of the Google Pay API supported cards as the only form of payment. The\n`CARD` [payment method](/pay/api/web/reference/request-objects#PaymentMethod)\nis one of multiple possible payment method options in version 2 of the Google Pay API. Sites that\npreviously specified an `allowedPaymentMethods` value of `CARD` must now set\nan `allowedAuthMethods` value of `PAN_ONLY`. Sites that previously specified\nan `allowedPaymentMethods` value of `TOKENIZED_CARD` must now set an\n`allowedAuthMethods` value of `CRYPTOGRAM_3DS`.\n\nAllowed card networks are specified alongside supported authentication methods for cards on\nthose networks. \n\n### apiVersion 1\n\n```javascript\n{\n allowedPaymentMethods: [\n 'CARD',\n 'TOKENIZED_CARD'\n ],\n cardRequirements: {\n allowedCardNetworks: [\n 'AMEX',\n 'DISCOVER',\n 'JCB',\n 'MASTERCARD',\n 'VISA'\n ]\n }\n}\n```\n\n### apiVersion 2\n\n```javascript\n{\n apiVersion: 2,\n apiVersionMinor: 0,\n allowedPaymentMethods: [{\n type: 'CARD',\n parameters: {\n allowedAuthMethods: [\n 'PAN_ONLY',\n 'CRYPTOGRAM_3DS'\n ],\n allowedCardNetworks: [\n 'AMEX',\n 'DISCOVER',\n 'JCB',\n 'MASTERCARD',\n 'VISA'\n ]\n }\n }]\n}\n```\n\nAllowed card networks and their authentication methods are included in an\n[`IsReadyToPayRequest`](/pay/api/web/reference/request-objects#IsReadyToPayRequest) for a `CARD`\n[payment method](/pay/api/web/reference/request-objects#PaymentMethod \"Object reference: payment method\").\n\nCard payment data tokenization\n------------------------------\n\nThe Google Pay API returns encrypted card data that's referenced by your specified gateway or\ndecrypted on your servers. Version 2 of the Google Pay API moves\n[payment method tokenization](/pay/api/web/reference/request-objects#PaymentMethodTokenizationSpecification \"Object reference: PaymentMethodTokenizationSpecification\")\ninside the `CARD` payment method. \n\n### apiVersion 1\n\n```javascript\n{\n paymentMethodTokenizationParameters: {\n tokenizationType: 'PAYMENT_GATEWAY',\n parameters: {\n 'gateway': '\u003cvar translate=\"no\"\u003eexample\u003c/var\u003e',\n 'gatewayMerchantId': '\u003cvar translate=\"no\"\u003eexampleMerchantId\u003c/var\u003e'\n }\n }\n}\n```\n\n### apiVersion 2\n\n```javascript\n{\n allowedPaymentMethods: [{\n type: 'CARD',\n tokenizationSpecification: {\n type: 'PAYMENT_GATEWAY',\n parameters: {\n 'gateway': '\u003cvar translate=\"no\"\u003eexample\u003c/var\u003e',\n 'gatewayMerchantId': '\u003cvar translate=\"no\"\u003eexampleMerchantId\u003c/var\u003e'\n }\n }\n }]\n}\n```\n\nGoogle merchant ID\n------------------\n\nA Google merchant ID was a top-level property in version 1 of the Google Pay API. Now, the\nGoogle merchant ID is placed inside a\n[`MerchantInfo`](/pay/api/web/reference/request-objects#MerchantInfo) object\nwith an optional merchant name. \n\n### apiVersion 1\n\n```javascript\n{\n merchantId: '12345678901234567890'\n}\n```\n\n### apiVersion 2\n\n```javascript\n{\n merchantInfo: {\n merchantId: '12345678901234567890'\n }\n}\n```\n\nBilling address\n---------------\n\nAn optional billing address and a billing phone number are associated with a `CARD` payment method.\nIf a site requests a billing address, any configuration related to the expected response is placed inside a\n[`BillingAddressParameters`](/pay/api/web/reference/request-objects#BillingAddressParameters) object. \n\n### apiVersion 1\n\n```javascript\n{\n cardRequirements: {\n billingAddressRequired: true,\n billingAddressFormat: 'FULL'\n },\n phoneNumberRequired: true\n}\n```\n\n### apiVersion 2\n\n```javascript\n{\n allowedPaymentMethods: [{\n type: 'CARD',\n parameters: {\n billingAddressRequired: true,\n billingAddressParameters: {\n format: 'FULL',\n phoneNumberRequired: true\n }\n }\n }]\n}\n```\n\nShipping address\n----------------\n\nAn optional shipping address requirement remains at the top level of the\n[`PaymentDataRequest`](/pay/api/web/reference/request-objects#PaymentDataRequest) object.\nThe `shippingAddressRequirements` property has been renamed\n[`shippingAddressParameters`](/pay/api/web/reference/request-objects#ShippingAddressParameters).\n\nEarlier Google Pay API responses might have returned a phone number as part of the shipping address\nwhen a phone number was requested. A shipping phone number is no longer supported by the Google Pay API in any version.\nAny response handlers that expect a shipping phone number must be updated. \n\n### apiVersion 1\n\n```javascript\n{\n shippingAddressRequired: true,\n shippingAddressRequirements: {\n allowedCountryCodes: [\n 'US',\n 'CA'\n ]\n }\n}\n```\n\n### apiVersion 2\n\n```javascript\n{\n shippingAddressRequired: true,\n shippingAddressParameters: {\n allowedCountryCodes: [\n 'US',\n 'CA'\n ]\n }\n}\n```\n\nPaymentData response\n--------------------\n\nThe [`PaymentData`](/pay/api/web/reference/response-objects#PaymentData) object response\nfor sites that set an `apiVersion` property value of `2` in\n[`PaymentDataRequest`](/pay/api/web/reference/request-objects#PaymentDataRequest)\nhas changed to reference cards as one of multiple possible payment data responses.\nThe `apiVersion` and `apiVersionMinor` properties included in the\n[`PaymentDataRequest`](/pay/api/web/reference/request-objects#PaymentDataRequest) object\nappear in the\n[`PaymentData`](/pay/api/web/reference/response-objects#PaymentData) response to indicate\nthe expected format. \n\n### apiVersion 1\n\n```javascript\n{\n // no version specified\n}\n```\n\n### apiVersion 2\n\n```javascript\n{\n apiVersion: 2,\n apiVersionMinor: 0\n}\n```\n\nInformation about a selected payment method and its tokenization is placed inside the\n[`paymentMethodData`](/pay/api/web/reference/response-objects#PaymentMethodData) property.\nTwo properties have been removed from the card payment method's `cardInfo` object:\n`cardClass` and `cardImageUri`. \n\n### apiVersion 1\n\n```javascript\n{\n cardInfo: {\n cardDescription: 'Visa •••• 1234',\n cardNetwork: 'VISA',\n cardDetails: 1234\n },\n paymentMethodToken: {\n tokenizationType: 'PAYMENT_GATEWAY',\n token: 'examplePaymentMethodToken'\n }\n}\n```\n\n### apiVersion 2\n\n```javascript\n{\n paymentMethodData: {\n type: 'CARD',\n description: 'Visa •••• 1234',\n info: {\n cardNetwork: 'VISA',\n cardDetails: '1234'\n },\n tokenizationData: {\n type: 'PAYMENT_GATEWAY',\n token: 'examplePaymentMethodToken'\n }\n }\n}\n```\n\nEncrypted message response\n--------------------------\n\nSites that specify a `DIRECT` payment method tokenization type and accept an\nAPI version 1 payment method of `TOKENIZED_CARD` must update how they handle the\ndecrypted `encryptedMessage` property. The site must do this to continue to forward\nAndroid device tokens authenticated with a 3-D Secure cryptogram and optional electronic commerce\nindicator (ECI) to your gateway or processor. Cards are a `paymentMethod` of\n`CARD`, with additional information about the selected card's authentication method in\n`paymentMethodDetails.authMethod`. \n\n### apiVersion 1\n\n```javascript\n{\n \"paymentMethod\": \"TOKENIZED_CARD\",\n \"paymentMethodDetails\": {\n \"authMethod\": \"3DS\",\n \"dpan\": \"1111222233334444\",\n \"expirationMonth\": 10,\n \"expirationYear\": 2020,\n \"3dsCryptogram\": \"AAAAAA...\",\n \"3dsEciIndicator\": \"eci indicator\"\n }\n}\n```\n\n### apiVersion 2\n\n```javascript\n{\n \"paymentMethod\": \"CARD\",\n \"paymentMethodDetails\": {\n \"authMethod\": \"CRYPTOGRAM_3DS\",\n \"pan\": \"1111222233334444\",\n \"expirationMonth\": 10,\n \"expirationYear\": 2020,\n \"cryptogram\": \"AAAAAA...\",\n \"eciIndicator\": \"eci indicator\"\n }\n}\n```"]]