KEMBAR78
Allow custom data for the active payment method to be provided to `PaymentResponse.prototype.complete` · Issue #981 · w3c/payment-request · GitHub
Skip to content

Allow custom data for the active payment method to be provided to PaymentResponse.prototype.complete #981

@dcrousso

Description

@dcrousso

It'd be great for there to be a standardized way for developers/merchants to provide data back to the PaymentRequest after it's been accepted. This would allow additional information to be provided back to the underlying platform payment method handler/UI.

I was thinking it'd be something like this:

partial interface PaymentResponse {
  [NewObject] Promise<undefined> complete(optional PaymentComplete result = "unknown", optional PaymentMethodData paymentMethod);
}

or maybe even just

partial interface PaymentResponse {
  [NewObject] Promise<undefined> complete(optional PaymentComplete result = "unknown", optional object paymentMethodData);
}

Alternatively, we maybe might want to wrap the PaymentComplete in a new IDL dictionary (just like PaymentValidationErrors), which would also allow for more extension in the future if desired.

enum PaymentResultStatus {
  "fail",
  "success",
  "unknown"
}

dictionary PaymentResult {
    PaymentResultStatus status = "unknown";
    PaymentMethodData paymentMethod;
}

partial interface PaymentResponse {
  [NewObject] Promise<undefined> complete(optional PaymentResultStatus = "unknown"); // Would we still want/need this?
  [NewObject] Promise<undefined> complete(optional PaymentResult);
}

Though (in both cases) I'm not sure if we want just a PaymentMethodData or a sequence<PaymentMethodData> so that a developer/merchant can declaratively provide data back to all supported payment methods at once instead of having to adjust the data based on which payment method is currently being used.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions