Re: [w3c/payment-request] fine grained error recovery for fields (#647)

Third alternative - from @rsolomakhin's notes from the F2F meeting.
  
`PaymentResponse.complete()` gets a new "retry" enum value for correcting payment errors. Merchant would specify an enum value like “billing addressing zip code is not correct” or “card declined,” for example. Then the user can attempt to fix the error and retry the payment. The payment handler should be able to specify whether a retry is possible, so push-payments can work correctly.

```JS
const response = await pr.show();
async function validateResponse(response){
  const badThings = await getInvalidThings(response);
  if (!badThings){
    return; // yay, it’s all good!
  }
  // Oh noes, let’s get the user to fix bad things
  await response.complete("retry", badThings);
  return validateResponse(response);
}
await validateResponse(response);
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/payment-request/issues/647#issuecomment-349873976

Received on Thursday, 7 December 2017 06:18:17 UTC