Copyright © 2016 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark and permissive document license rules apply.
(예를 들어 웹 사이트에서 물리적 혹은 디지털 상품을 판매하는) 판매자가 다양한 결제 방법에서 쉽게 최소한의 통합으로 결제를 받을 수 있게 허용하는 웹 API를 설명합니다. 유저 에이전트 (즉 브라우저)는 판매자와 유저 사이의 결제 흐름을 용이하게 해야합니다.
This specification describes a web API to allow merchants (i.e. web sites selling physical or digital goods) to easily accept payments from different payment methods with minimal integration. User agents (e.g. browsers) will facilitate the payment flow between merchant and user.
역주 : 이 문서는 Working Draft이기 때문에 구태여 Status of Document는 번역하지 않습니다.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
The working group maintains a list of all bug reports that the group has not yet addressed. This draft highlights some of the pending issues that are still to be discussed in the working group. No decision has been taken on the outcome of these issues including whether they are valid. Pull requests with proposed specification text for outstanding issues are strongly encouraged.
This specification was derived from a report published previously by the Web Platform Incubator Community Group.
This document was published by the Web Payments Working Group as a First Public Working Draft. This document is intended to become a W3C Recommendation. If you wish to make comments regarding this document, please send them to public-payments-wg@w3.org (subscribe, archives). All comments are welcome.
Publication as a First Public Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
This document is governed by the 1 September 2015 W3C Process Document.
이 섹션은 표준에 준하지 않습니다.
웹에서 물건을 사는 건, 특히 모바일에서, 유저에게 좌절감을 주는 경험일 수 있습니다. 각 웹 사이트는 제각각의 흐름과 검증(valication) 규칙을 가지고, 유저에게 같은 정보 셋을 매번 수동으로 입력하기를 요청합니다. 마찬가지로, 개발자가 좋은 결제 흐름과 다양한 결제 스킴을 지원하는 건 시간이 오래 걸리고 어렵습니다.
Buying things on the web, particularly on mobile, can be a frustrating experience for users. Every web site has its own flow and its own validation rules, and most require users to manually type in the same set of information over and over again. Likewise, it is difficult and time consuming for developers to create good checkout flows that support various payment schemes.
이 스펙에서는 유저 에이전트가 매 거래 때마다 세 주요 그룹 사이의 중간으로써 동작할 수 있게 하는 API를 설명합니다. 세 주요 그룹에는 판매자 (예: 온라인 웹 스토어), 구매자 (예: 온라인 웹 스토어에서 구매하려는 유저), 그리고 결제 수단 (예: 신용 카드)이 있습니다. 거래를 확인하고 처리하기 위한 정보는 구매자가 흐름을 타기 위해 필요한 인증 및 승인을 거친 유저 에이전트를 통해 판매자와 결제 수단 사이에 전달됩니다.
This specification describes an API that allows user agents (e.g. browsers) to act as an intermediary between the three key parties in every transaction: the merchant (e.g. an online web store), the buyer (e.g. the user buying from the online web store), and the Payment Method (e.g. credit card). Information necessary to process and confirm a transaction is passed between the Payment Method and the merchant via the user agent with the buyer confirming and authorizing as necessary across the flow.
더불어 좋고, 더 일관된 사용자 경험을 제공하고, 웹 사이트에서 표준 자바스크립트 라이브러리로 구현할 수 없는 더 안전한 결제 스킴 (예: 토큰화 및 시스템 수준의 인증)을 제공하는 이점을 취할 수 있습니다. 이는 판매자에 대한 책임을 감소시키고, 예민한 유저 정보를 보호하는 데 도움을 줍니다.
In addition to better, more consistent user experiences, this also enables web sites to take advantage of more secure payment schemes (e.g. tokenization and system-level authentication) that are not possible with standard JavaScript libraries. This has the potential to reduce liability for the merchant and helps protect sensitive user information.
이 문서에서 설명하는 API는 결제 요청 아키텍쳐 [PAYMENTARCH] 문서 내 결제 요청 시스템의 일부로 구성되어있습니다.
The API described in this document forms part of the Payment Request system described in the Payment Request Architecture [PAYMENTARCH] document.
Allow the user agent to act as intermediary between merchants, users, and payment methods
Standardize (to the extent that it makes sense) the communication flow between a merchant, user agent, and payment method
Allow payment methods to bring more secure payment transactions to the web
Not trying to create a new payment method
Not trying to integrate directly with payment processors
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key words MAY, MUST, and SHOULD are to be interpreted as described in [RFC2119].
This specification defines one class of products:
A user agent MUST behave as described in this specification in order to be considered conformant. In this specification, user agent means a Web browser or other interactive user agent as defined in [HTML5].
User agents MAY implement algorithms given in this specification in any way desired, so long as the end result is indistinguishable from the result that would be obtained by the specification's algorithms.
A conforming Payment Request API user agent MUST also be a conforming implementation of the IDL fragments of this specification, as described in the “Web IDL” specification. [WEBIDL]
이 스펙은 여러 다른 스펙에 의존합니다
This specification relies on several other underlying specifications.
TypeError
, JSON.stringify, and JSON.parse are
defined by [ECMA-262-2015].
This document uses the format object@[[slotname]] to mean the internal slot [[slotname]] of the object object.
The term JSON-serializable object used in this specification means an object that can be serialized to a string using JSON.stringify and later deserialized back to an object using JSON.parse with no loss of data.
Event
type and the terms fire an event, dispatch flag,
stop propagation flag, and stop immediate propagation flag are defined by [DOM4].
DOMException and the following DOMException types from [DOM4] are used:
Type | Message (optional) |
---|---|
InvalidStateError | The object is in an invalid state |
NotSupportedError | The payment method was not supported |
SecurityError | The operation is only supported in a secure context |
[Constructor(sequence<DOMString> supportedMethods, PaymentDetails
details, optional PaymentOptions
options, optional object data)]
interface PaymentRequest : EventTarget {
Promise<PaymentResponse
> show();
void abort();
readonly attribute ShippingAddress
? shippingAddress;
readonly attribute DOMString? shippingOption;
// Supports "shippingaddresschange" event
attribute EventHandler onshippingaddresschange;
// Supports "shippingoptionchange" event
attribute EventHandler onshippingoptionchange;
};
웹 페이지는 결제 요청을 만들기 위해
를 생성합니다.
이는 보통 결제 프로세스에 진입하는 유저와 관련있습니다.
(예: 게임에서 "파워 업"을 선택했을 때, 자동으로 주차장 구조의 키오스크가 나오거나, "구매", "결제", "체크아웃"버튼이 활성화 되거나 하는 등)
PaymentRequest
는
유저가 결제 요청을 승인하거나 거절하기 전에 입력을 제공하여,
웹 페이지가 유저 에이전트와 정보를 교환할 수 있게 합니다.
PaymentRequest
A web page creates a
to make a payment request. This is
typically associated with the user initiating a payment process
(e.g., selecting a "Power Up" in an interactive game, pulling up to an automated kiosk in a parking structure,
or activating a "Buy", "Purchase", or "Checkout" button).
The PaymentRequest
allows the web page to exchange information with the
user agent while the user is providing input before approving or denying a payment request.
PaymentRequest
다음 예제는
를 어떻게 구성해야 하는 지와 유저 인터렉션의 시작을 나타내는 예제입니다.
PaymentRequest
The following example shows how to construct a
and begin the
user interaction:
PaymentRequest
var payment = new PaymentRequest(supportedMethods, details, options, data); payment.addEventListener("shippingaddresschange", function (changeEvent) { // 배송지 변경 처리 }); payment.show().then(function(paymentResponse) { // paymentResponse 처리 // paymentResponse.methodName이 선택된 결제 수단을 포함함 // paymentResponse.details가 응답에서 정의한 결제 수단을 포함함 paymentResponse.complete(true); }).catch(function(err) { console.error("어머, 뭔가 이상해요", err.message); });
는 제공된
PaymentRequest
supportedMethods
목록, 결제 details
, 결제 options
, 그리고 data
로 정의된 어떤
결제 수단으로 구성합니다.
The
is constructed using the supplied PaymentRequest
supportedMethods
list, the payment details
, the payment options
, and any payment
method specific data
.
supportedMethods
시퀀스는 판매자가 웹 사이트에서 허용하는 결제 수단을 위한 결제 수단 식별자를 포함합니다.
The supportedMethods
sequence contains the payment method identifiers for the payment methods that the merchant web site accepts.
["visa", "bitcoin", "bobpay.com"]
details
객체는 유저가 주문에서 라인 아이템을 완료하기 위해 요구되는 거래 관련 정보를 포함합니다.
The details
object contains information about the transaction that the
user is being asked to complete such as the line items in an order.
{ "items": [ { "id": "basket", "label": "Sub-total", "amount": { "currency": "USD", "value" : "55.00" }, // US$55.00 }, { "id": "tax", "label": "Sales Tax", "amount": { "currency": "USD", "value" : "5.00" }, // US$5.00 }, { "id": "total", "label": "Total due", "amount": { "currency": "USD", "value" : "60.00" }, // US$60.00 } ] }
options
객체는 웹 페이지가 결제 요청 시스템으로부터 사용하기를 원하는 옵션에 대한 정보를 포함합니다.
The options
object contains information about what options the web page
wishes to use from the payment request system.
{ "requestShipping": true }
data
는 지원하는 결제 수단에서 필요로 할 수 있는 옵션 정보를 가지는
시리얼화된 JSON 객체입니다.
data
is a JSON-serializable object that provides optional information that might
be needed by the supported payment methods.
{ "bobpay.com": { "merchantIdentifier": "XXXX", "bobPaySpecificField": true }, "bitcoin": { "address": "XXXX" } }
supportedMethods
, details
, and data
should be combined into a single object.
navigator.payments
, using a factory method to create an instance, or using a constructor as
currently described in the specification.
생성자는 반드시 아래 순서대로 동작해야합니다. [MUST]
PaymentRequest
The
constructor MUST act as follows:
PaymentRequest
supportedMethods
시퀀스의 길이가 0이라면,
TypeError
를 던집니다.
If the length of the supportedMethods
sequence is zero, then throw
a
.
TypeError
SecurityError
를
던집니다.
If the global object of the script calling the constructor is
not considered a secure context, then throw a
.
SecurityError
SecurityError
를
던집니다.
If the browsing context of the script calling the constructor is
not a top-level browsing context, then throw a
.
SecurityError
There is an open issue about requiring
a top-level browsing context for using PaymentRequest
. Requiring one
is a mitigation for a user being tricked into thinking a trusted site is asking for
payment when in fact an untrusted iframe is asking for payment. The problem is some iframes may
have a legitimate reason to request payment.
details
가 0개보다 더 큰 길이인 items
의 시퀀스를 포함하지 않는다면,
TypeError
를
던집니다.
If details
does not contain a sequence of items
with length greater
than zero, then throw a
.
TypeError
data
가 시리얼화된 JSON 객체가 아니라면,
TypeError
를 던집니다.
If data
is not a JSON-serializable object, then throw a
.
TypeError
data
의 어떤 상위 레벨 필드의 이름이
supportedMethods
내 결제 수단 식별자 중 하나라도 매치되지 않는다면,
TypeError
를 던집니다.
If the name of any top level field of data
does not match one of the payment method identifiers
in supportedMethods
, then throw a
.
TypeError
TypeError
를 던집니다.
If the value of any top level field is not a JSON-serializable object, then
throw a
.
TypeError
PaymentRequest
로 합니다.
Let request be a new
.PaymentRequest
supportedMethods
를 담습니다.
Store supportedMethods
into request@[[supportedMethods]].
details
를 담습니다.
Store details
into request@[[details]].
options
를 담습니다.
Store options
into request@[[options]].
data
를 담습니다.
Store data
into request@[[data]].
Set the value request@[[state]] to created.
shippingAddress
속성 값을 null로 설정합니다.
Set the value of the
attribute on request to null.
shippingAddress
shippingOption
속성 값을 null로 설정합니다.
Set the value of the
attribute on request to null.
shippingOption
details
가 길이가 1인 shippingOptions
시퀀스를 포함하고 있다면,
shippingOption
을
시퀀스 내 단일 ShippingOption
의 id
로 설정합니다.
If details
contains a shippingOptions
sequence with a
length of 1, then set
to the shippingOption
id
of
the only
in the sequence.
ShippingOption
Set the value request@[[updating]] to false.
Return request.
show
메서드는 페이지에서 결제 요청에 따른 유저 인터렉션을 시작하고 싶을 때 호출합니다.
show
메서드는 유저가 결제 요청을 승인했을 때
해소되는 Promise를 반환합니다.
유저 인터페이스 중 몇가지는 유저가 결제 요청을 원활하게 하도록 show
메서드 반환 이후 보여집니다.
The show
method is called when the page wants to begin user interaction for the
payment request. The show
method will return a Promise that will be resolved when the
user accepts the payment request.
Some kind of user interface will be presented to the user to facilitate the
payment request after the show
method returns.
It may help users understand what they are accepting if the web site is able to label the "accept" button. For example, if a user is about to "Buy" something, "Reserve" something, "Subscribe" to something, etc. That said, this may create payment interface/experience issues and accidentally lead to customers thinking they're performing actions like a one-time purchase, when they are in fact signing up for a subscription.
메서드는 반드시 아래 순서대로 동작해야합니다. [MUST]
show
The
method MUST act as follows:
show
PaymentRequest
객체로 합니다.
Let request be the
object on which the method is called..PaymentRequest
InvalidStateError
를 던집니다.
If the value of request@[[state]] is not created then
throw an
.
InvalidStateError
Set the value of request@[[state]] to interactive.
Let acceptPromise be a new Promise.
Store acceptPromise in request@[[acceptPromise]].
Return acceptPromise and asynchronously perform the remaining steps.
Let acceptedMethods be the sequence of payment method identifiers request@[[supportedMethods]] with all identifiers removed that the user agent does not accept.
NotSupportedError
와 함께 acceptPromise를 받지 않습니다.
If the length of acceptedMethods is zero, then reject acceptPromise with a
.
NotSupportedError
Show a user interface to allow the user to interact with the payment request process. The acceptPromise will later be resolved by the user accepts the payment request algorithm through interaction with the user interface.
abort
메소드는 웹 페이지에서
메서드가 호출된 이후 [[acceptPromise]]가 해결되기 전에 결제 요청을 취소하기를 원할 때 호출합니다.show
The abort
method may be called if the web page wishes to abort the payment
request after the
method has been called and before the [[acceptPromise]]
has been resolved.show
메서드는 반드시 아래 순서대로 동작해야합니다. [MUST]abort
The
method MUST act as follows:abort
InvalidStateError
를
던집니다.
If the value of [[state]] is not interactive then
throw an
.
InvalidStateError
Set the value of the internal slot [[state]] to closed.
Return from the method and asynchronously perform the remaining steps.
Abort the current user interaction and close down any remaining user interface
내장 슬롯 [[state]]는 아래의 상태 변화를 따릅니다:
The internal slot [[state]] follows the following state transitions:
역주: 아래 이미지는 원래 엑박이에요..
shippingAddress
는 유저가 배송지를 제공할 때 채워집니다.
기본값은 null입니다.
유저가 배송지를 제공할 때, 배송지 변경 알고리즘이 동작합니다.
shippingAddress
is populated when the user provides a shipping
address. It is null by default.
When a user provides a shipping address, the shipping address changed algorithm runs.
onshippingaddresschange
는
shippingaddresschange
Event
를 위한 EventHandler
입니다.
onshippingaddresschange
is an EventHandler
for an
Event
named shippingaddresschange
.
shippingOption
은 유저가 배송 옵션을 선택했을 때 채워집니다.
기본값은 null입니다.
유저가 배송 옵션을 선택했을 때, 배송 옵션 변경 알고리즘이 동작합니다.
shippingOption
is populated when the user chooses a shipping
option. It is null by default.
When a user chooses a shipping option, the shipping option changed algorithm runs.
onshippingoptionchange
는
shippingoptionchange
Event
를 위한 EventHandler
입니다.
onshippingoptionchange
is an EventHandler
for an
Event
named shippingoptionchange
.
의 인스턴스는 아래 표의 내장 슬롯과 함께 생성됩니다.PaymentRequest
Instances of
are created with the internal slots in
the following table:PaymentRequest
내장 슬롯 | 설명 (표준이 아님) |
---|---|
[[supportedMethods]] |
supportMethods 는 생성자로 제공됩니다.
The |
[[details]] |
결제 요청을 위한 현재 는 생성자에 의해 초기화되고 생성되며
를 호출하여 갱신합니다.
The current |
[[options]] |
은 생성자로 제공됩니다.
The |
[[data]] |
data 에 정의된 결제 수단은 앱의 동작에 영향을 주는 Payment App에서 사용하는 생성자로 제공됩니다.
The payment method specific |
[[state]] |
결제 요청 중 현재 상태입니다.
The current state of the payment request. |
[[updating]] |
true는 결제 요청을 업데이트하기 위해 을 호출한 상태이고,
false는 그 외의 경우입니다.
true is there is a pending |
[[acceptPromise]] |
중에 생성된
보류중인 Promise는 유저가 결제 요청을 수락하면 해결됩니다.
The pending Promise created during |
dictionary CurrencyAmount {
required DOMString currency;
required DOMString value;
};
사전은 금전 합계를 제공할 때 사용합니다.
아래 필드는 유효한 CurrencyAmount
를 위해,
반드시 제공해야합니다. [MUST]
CurrencyAmount
The
dictionary is used to supply monetary amounts.
The following fields MUST be supplied for a CurrencyAmount
to be valid:
CurrencyAmount
currency
currency
는 화폐 식별자를 포함하는 문자열입니다.
대부분의 식별자는 [ISO4217]에서 정의하는 알파벳으로 구성된 세 글자 코드(예를 들어, "USD"
는 US 달러를 나타냅니다)로 이루어져 있으나,
임의의 문자열도 유효할 수 있도록 고려해야하며,
user agents는 반드시 이 문자열의 유효성을 검증해서는 안됩니다.
currency
is a string containing a currency identifier. The most common
identifiers are three-letter alphabetic codes as defined by [ISO4217] (for example,
"USD"
for US Dollars) however any string is considered valid and
user agents MUST not attempt to validate this string.
value
A string containing the decimal monetary value. If a decimal separator is needed then the string MUST use a single U+002E FULL STOP character as the decimal separator. The string MUST begin with a single U+002D HYPHEN-MINUS character if the value is negative. All other characters must be characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9).
^-?[0-9]+(\.[0-9]+)?$
The string should match the regular expression ^-?[0-9]+(\.[0-9]+)?$
.
다음 예제는 US$55.00을 나타냅니다.
The following example shows how to represent US$55.00.
{ "currency": "USD", "value" : "55.00" }
dictionary PaymentDetails
{
sequence<PaymentItem
> items;
sequence<ShippingOption
> shippingOptions;
};
PaymentDetails
사전은
생성자로 전달되며,
요청 거래에 대한 정보를 제공합니다. PaymentRequest
PaymentDetails
사전 또한
를 사용하여
결제 요청을 갱신할 수 있습니다.
updateWith
The PaymentDetails
dictionary is passed to the
constructor and provides information about the requested transaction. The PaymentRequest
PaymentDetails
dictionary is also used to update the payment request using
.
updateWith
다음 필드는 PaymentDetails
사전의 일부입니다.
The following fields are part of the PaymentDetails
dictionary:
items
PaymentItem
사전의 시퀀스는
결제 요청이 무엇을 위한 것인지 감지합니다. 이 시퀀스는 반드시 최소한 하나 이상 PaymentItem
을 가져야합니다.
시퀀스 내 마지막 PaymentItem
은 결제 요청의 총량을 나타냅니다.
이 호출 코드가 담당하는 건 이전 아이템의 합이 총량이 되도록 하는 것입니다.
유저 에이전트는 만약 이 값이 true라면 검증을 하지 않을 수도 있습니다. [MAY]
This sequence of
dictionaries indicates what the payment
request is for. The sequence must contain at least one PaymentItem
PaymentItem
. The last
PaymentItem
in the sequence represents the total amount of the payment
request. It is the responsibility of the calling code to ensure that the total amount is
the sum of the preceding items. The user agent MAY not validate that this is true.
shippingOptions
선택에 사용할 수 있는 다른 배송 옵션을 포함하는 시퀀스입니다.
만약 시퀀스가 비어있다면,
이는 판매자가 현재
에 배송할 수 없다고 감지합니다.
shippingAddress
만약 시퀀스가 하나의 아이템만 가지고 있다면,
이는 이후에 사용될 배송 옵션이 되고
은
배송 옵션 변경 알고리즘을 사용하지 않는 옵션의 shippingOption
id
로 정의됩니다.
A sequence containing the different shipping options that the use may choose from.
If the sequence is empty, then this indicates that the merchant
cannot ship to the current
.shippingAddress
If the sequence only contains one item, then this is the shipping option that
will be used and
will be set to the shippingOption
id
of this option without running the shipping option changed algorithm.
items
sequence should special-case the last
item in the sequence to represent the total.
dictionary PaymentOptions
{
boolean requestShipping = false;
};
PaymentOptions
사전은
생성자로 전달되며,
결제 요청 시 원하는 옵션에 대한 정보를 제공합니다.
PaymentRequest
The PaymentOptions
dictionary is passed to the
constructor and provides information about the options desired for the payment request.
PaymentRequest
아래 필드들은
생성자로 인해
전달될 수도 있습니다. [MAY]
PaymentRequest
The following fields MAY be passed to the
constructor:
PaymentRequest
requestShipping
true
로 설정합니다.
온라인에서만 판매하는 전자 상품 거래인 경우에는 이 값을 false
로 설정합니다.
만약 이 값이 제공되지 않은 경우 PaymentRequest
는
false
값이 제공되었다고 가정하여 동작합니다.
This boolean value indicates whether the user agent should collect and return
a shipping address as part of the payment request. For example, this would be set to
true
when physical goods need to be shipped by the merchant to the user.
This would be set to false
for an online-only electronic purchase transaction.
If this value is not supplied then the the
behaves as
if a value of PaymentRequest
false
had been supplied.
dictionary PaymentItem {
required DOMString id;
required DOMString label;
required CurrencyAmount
amount;
};
하나 혹은 그 이상의 PaymentItem
사전 시퀀스는
사전에 포함되어 있으며,
결제 요청이 있을 때 요청한 값이 무엇인 지 나타냅니다.
PaymentDetails
A sequence of one or more PaymentItem
dictionaries is included in the
dictionary to indicate the what the payment request is for and the value asked for.
PaymentDetails
아래 필드는 반드시 PaymentItem
에 유효한 값으로 포함해야 합니다. [MUST]
The following fields MUST be included in a PaymentItem
for it to be valid:
id
PaymentItem
에 참조하기 위해 사용하는 문자열 식별자입니다.
이 값은 반드시 PaymentRequest
에 고유한 값으로 주어야 합니다. [MUST]
This is a string identifier used to reference this PaymentItem
. It MUST be
unique for a given
.
PaymentRequest
label
This is a human-readable description of the item. The user agent may display this to the user.
amount
CurrencyAmount
입니다.
A
containing the monetary amount for the item.
CurrencyAmount
PaymentItem
with amounts in more than once currency.
interface ShippingAddress
{
// [...] fields TBC
};
만약 PaymentRequest
에서 전달한
PaymentOptions
내의
requestShipping
플래그가
true
로 설정되어 있다면,
유저 에이전트는
객체의
PaymentRequest
shippingAddress
필드를
사용자가 선택한 배송지로 채웁니다.
If the requestShipping
flag was set to true
in the PaymentOptions
passed to the PaymentRequest
constructor, then the user agent will populate the
shippingAddress
field of the
object with
the user's selected shipping address.
PaymentRequest
ShippingAddress
interface are
yet to be defined.
dictionary ShippingOption
{
required string id;
required string label;
required CurrencyAmount
amount;
};
ShippingOption
사전은 배송 옵션을 설명하는 필드를 가집니다.
웹 페이지에서는 유저에게 하나 혹은 그 이상의 배송 옵션을 updateWith
메소드를 호출 한 뒤 변경 이벤트를 받아서 제공할 수 있습니다.
The ShippingOption
dictionary has fields describing a shipping option. A web page can
provide the user with one or more shipping options by calling the updateWith
method in response to a change event.
아래 필드는 반드시 PaymentItem
에 유효한 값으로 포함해야 합니다. [MUST]
The following fields MUST be included in a PaymentItem
for it to be valid:
id
ShippingOption
에 참조하기 위해 사용하는 문자열 식별자입니다.
이 값은 반드시 PaymentRequest
에 고유한 값으로 주어야 합니다. [MUST]
This is a string identifier used to reference this ShippingOption
. It MUST be
unique for a given
.
PaymentRequest
label
This is a human-readable description of the item. The user agent SHOULD use this string to display the shipping option to the user.
amount
CurrencyAmount
입니다.
A
containing the monetary amount for the item.
CurrencyAmount
interface PaymentResponse
{
readonly attribute DOMString methodName;
readonly attribute object details;
Promise<void> complete(boolean success);
};
PaymentResponse
는
유저가 결제 방법을 선택하고 결제 요청을 동의했을 때 반환됩니다.
이는 아래 필드를 포함합니다.
A PaymentResponse
is returned when a user has selected a payment method and
approved a payment request. It contains the following fields:
methodName
The payment method identifier for the payment method that the user selected to fulfil the transaction.
details
A JSON-serializable object that provides a payment method specific message used by the merchant to process the transaction and determine successful fund transfer.
complete
메서드는 반드시 유저가 결제 요청을 허락하고
[[acceptPromise]가 해결된 뒤 호출해야합니다.
complete
메서드는 불리언 타입의 인수를 가지며,
이 인수가 true
인 경우 프로세스를 성공적으로 진행한 것이며,
false
인 경우 프로세스를 실패한 것입니다.
complete
메서드를 호출하여 유저 에이전트의 유저 인터렉션을 끝내도록 지시합니다. (그리고 나머지 유저 인터페이스도 다 닫아야합니다.)
The complete
method must be called after the user has accepted the payment
request and the [[acceptPromise]] has been resolved. The complete
method
takes a boolean argument that indicates the payment was successfully processed if true
and
that processing failed if false
. Calling the complete
method tells the user
agent that the user interaction is over (and should cause any remaining user interface to be closed).
메서드는 반드시 아래 순서대로 동작해야합니다. [MUST]complete
The
method MUST act as follows:complete
Let promise be a new Promise.
InvalidStateError
를
던집니다.
If the value of the internal slot [[completeCalled]] is true, then throw an
.
InvalidStateError
Set the value of the internal slot [[completeCalled]] to true.
Return promise and asynchronously perform the remaining steps.
success
값을
결제 요청을 허용하는 Payment App으로 전달합니다.
Pass the value of success
to the Payment App that accepted the
payment request.
Close down any remaining user interface.
Resolve promise with undefined
.
의 인스턴스는 아래 표의 내장 슬롯과 함께 생성됩니다.PaymentResponse
Instances of
are created with the internal slots in
the following table:PaymentResponse
내장 슬롯 | 설명 (표준이 아님) |
---|---|
[[completeCalled]] |
만약 메서드가 호출되었다면
true, 그 외의 경우 false
true if the |
이 섹션은 표준에 준하지 않습니다.
이벤트 이름 | 인터페이스 | 언제 전달되는 지... |
---|---|---|
shippingaddresschange |
PaymentRequestUpdateEvent |
유저가 새로운 배송지를 제공한다.
The user provides a new shipping address. |
shippingoptionchange |
PaymentRequestUpdateEvent |
유저가 새로운 배송 옵션을 선택한다.
The user chooses a new shipping option. |
[Constructor(DOMString type, optionalPaymentRequestUpdateEventInit
eventInitDict)] interface PaymentRequestUpdateEvent :Event
{ void updateWith(Promise<PaymentDetails
> d); }; dictionary PaymentRequestUpdateEventInit : EventInit { };
는 웹 페이지가 유저 인터렉션에 반응하여 결제 요청 디테일을 업데이트 할 수 있게 합니다.PaymentRequestUpdateEvent
The
enables the web page to update
the details of the payment request in response to a user interaction.PaymentRequestUpdateEvent
만약 웹 페이지가 결제 요청을 갱신하기를 원한다면
를 호출하고,
유저 에이전트가 유저에게 보여주는 [user agent SHOULD]
변경 값을 포함하는 updateWith
사전과 함께 해결되는 promise를 제공해야 합니다.PaymentDetails
If the web page wishes to update the payment request then it should call
and provide a promise that will resolve with a updateWith
dictionary containing changed values that the user agent SHOULD present to the user.PaymentDetails
PaymentRequestUpdateEvent 생성자는 반드시 내장 슬롯 [[waitForUpdate]]를 false로 해야합니다. [MUST]
The PaymentRequestUpdateEvent constructor MUST set the internal slot [[waitForUpdate]] to false.
updateWith
메서드는 반드시 아래 순서대로 동작해야합니다. [MUST]
The updateWith
method MUST act as follows:
PaymentRequest
객체로 합니다.
Let target be the
object that is the target of
the event.
PaymentRequest
InvalidStateError
를
던집니다.
If the dispatch flag is unset, then throw an
.
InvalidStateError
InvalidStateError
를
던집니다.
If [[waitForUpdate]] is true, then throw an
.
InvalidStateError
InvalidStateError
를
던집니다.
If target@[[state]] is not interactive, then throw an
.
InvalidStateError
InvalidStateError
를
던집니다.
If target@[[updating]] is true, then throw
an
.
InvalidStateError
Set the stop propagation flag and stop immediate propagation flag.
Set [[waitForUpdate]] to true.
Set target@[[updating]] to true.
d
를 해결해야합니다.
[MUST]
The user agent SHOULD disable the user interface that allows the user to accept
the payment request.
This is to ensure that the payment is not accepted until the web page
has made changes required by the change.
The web page MUST settle the promise d
to indicate that the payment request is valid again.
유저 에이전트는 다른 갱신 이벤트 발생을 박기 위해 유저 인터페이스의 모든 부분을 비활성화해야합니다. [SHOULD] 한번에 하나의 갱신만 처리합니다.
The user agent SHOULD disable any part of the user interface that could cause another update event to be fired. Only one update may be processed at a time.
Return from the method and asynchronously perform the remaining steps.
d
가 놓일 때까지 기다립니다.
Wait until d
settles.
d
가 details
와 함께 해결되었고 details
가 PaymentDetails
사전이라면:
If d
is resolved with details
and details
is a
dictionary, then:
PaymentDetails
details
가 items
값을 가진다면,
이 값을 target@[[details]]의 items
필드에 복사합니다.
If details
contains an items
value, then copy
this value to the items
field of target@[[details]].
details
가 shippingOptions
시퀀스를 가진다면,
이 값을 target@[[details]]의 shippingOptions
필드에 복사합니다.
If details
contains a shippingOptions
sequence, then
copy this value to the shippingOptions
field of target@[[details]].
Let newOption be null.
details
가 shippingOptions
시퀀스를 가지고 그 길이가 1이라면,
newOption을 시퀀스 내 단일 ShippingOption
의 id
로 설정합니다.
If details
contains a shippingOptions
sequence with a
length of 1, then set newOption to the id
of the only
in the sequence.
ShippingOption
shippingOption
값을
newOption으로 설정합니다.
Set the value of
on target to
newOption.
shippingOption
Set [[waitForUpdate]] to false.
Set target@[[updating]] to false.
The user agent should update the user interface based on any changed values in target. The user agent SHOULD re-enable user interface elements that might have been disabled in the steps above if appropriate.
The spec needs to clearly state how it will handle internationalization issues (such as selection order for language via explicit preferences, Accept-Language headers, etc.)
The spec should indicate how data might be passed securely through the API using mechanisms such as field level encryption and message signing. While these may not be standardised a reference to the payment method specifications would be appropriate as well as some examples of how those specifcations might implement secure messaging.
객체의 내장 슬롯 [[state]]가
interactive로 지정되었을 때,
유저 에이전트는 아래 알고리즘을 유저 인터렉션을 기반으로 일으켜야합니다.
PaymentRequest
When the internal slot [[state]] of a
object is set to
interactive, the user agent will trigger the following algorithms based
on user interaction.PaymentRequest
배송지 변경 알고리즘은 유저가 새 배송지를 제공했을 때 동작합니다. 이는 반드시 아래 순서대로 동작해야합니다. [MUST]
The shipping address changed algorithm runs when the user provides a new shipping address. It MUST run the following steps:
PaymentRequest
객체로 합니다.
Let request be the
object that the user is
interacting with.PaymentRequest
shippingaddresschange
로 합니다.
Let name be shippingaddresschange
.
shippingAddress
속성을 유저가 제공한 배송지로 설정합니다.
Set the
attribute on request to the
shipping address provided by the user.
shippingAddress
Run the PaymentRequest updated algorithm with request and name.
배송 옵션 변경 알고리즘은 유저가 새로운 배송 옵션을 선택했을 때 동작합니다. 이는 반드시 아래 순서대로 동작해야합니다. [MUST]
The shipping option changed algorithm runs when the user chooses a new shipping option. It MUST run the following steps:
PaymentRequest
객체로 합니다.
Let request be the
object that the user is interacting with.
PaymentRequest
shippingoptionchange
로 합니다.
Let name be shippingoptionchange
.
shippingOption
속성을 유저가 제공한 ShippingOption
의
id
문자열로 설정합니다.
Set the
attribute on request to the
shippingOption
id
string of the
provided by the user.
ShippingOption
Run the PaymentRequest updated algorithm with request and name.
PaymentRequest 갱신 알고리즘은
유저가 name의 이벤트 네임과 함께 request로 호출되는
를 변경을 나타내기 위해
이벤트를 발생시키는 위의 다른 알고리즘에 의해 동작합니다.
PaymentRequest
The PaymentRequest updated algorithm is run by other algorithms above to fire
an event to indicate that a user has made a change to a
called request with an event name of name.PaymentRequest
It MUST run the following steps:
If the request@[[updating]] is true, then terminate this algorithm and take no further action. Only one update may take place at a time. This should never occur.
If the request@[[state]] is not set to interactive, then terminate this algorithm and take no further action. The user agent user interface should ensure that this never occurs.
PaymentRequestUpdateEvent
로 합니다.
Let event be a new
.
PaymentRequestUpdateEvent
Queue a task to fire an event named name of type event at request.
The
interface allows a web page to call PaymentRequest
abort
to tell the user agent to abort the payment request and to tear down any user interface that
might be shown. For example, a web page may choose to do this the goods they are selling are
only available for a limited amount of time. If the user does not accept the payment request
within the allowed time period, then the request will be aborted.
A user agent may not always be able to abort a request. For example, if the user agent has delegated responsibility for the request to another app. To support this situation, the user agent must run the User agent delegates payment request algorithm. The algorithm MUST run the following steps:
PaymentRequest
object that the user is
interacting with.
The architecture document suggests that payment apps may take numerous forms, including as web-based apps. This specification should describe how the user-agent will pass the payment request data and the complete signal to a web-based payment app and also how it will receive the payment response from the payment app.
We believe there are user agent configurations that can cause the UI to get into a state where cancellation by the web page during user interaction is difficult. Users should still be able to cancel the payment but script will not be able to. We need to investigate in more detail the consequences of this and whether it is really needed.
If we specify delegated
then it isn't necessary for all user agents to be
able to move to this state but it would be necessary for all payment flows that wish to call
to account for the situation where this may fail in the abort
delegated
state.
This specification should describe how the user agent will pass the payment request data and the complete signal to a native payment app and also how it will receive the payment response from the payment app.
The user accepts the payment request algorithm runs when the user accepts the payment request and confirms that they want to pay. It MUST run the following steps:
PaymentRequest
object that the user is
interacting with.
delegated
, then terminate this algorithm and take no further action.
The user agent user interface should ensure that this never occurs.
requestShipping
value of request@[[options]]
is true
, then if the shippingAddress
attribute of request
is null
or if the shippingOption
attribute of request
is null
, then terminate this algorithm and take no further action. This should
never occur.
PaymentResponse
.
methodName
attribute value of response to the payment method identifier
for the payment method that the user selected to accept the payment.
details
attribute value of response to a JSON-serializable object
containing the payment method specific message used by the merchant to process
the transaction. The format of this response will be defined by a Payment Transaction
Message Specification.