-
Notifications
You must be signed in to change notification settings - Fork 137
Description
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.