简体   繁体   English

stripe.redirectToCheckout 的“结果 object”是什么?

[英]What is the " result object " from stripe.redirectToCheckout?

    var stripe = Stripe('pk_test_51JaZneFymkOlJfbtifS7RjJeFPZTchtlvU5iiVmemkU76vOFWWPZOW9GwBDb9518RCoOfkvUQkGV92TyEMaXqYgh00eb6kLKZj');
     var session = "<?php echo $checkout_session['id']; ?>";
          stripe.redirectToCheckout({ sessionId: session })
                  .then(function(result) {
          // If `redirectToCheckout` fails due to a browser or network
          // error, you should display the localized error message to your
          // customer using `error.message`.
          if (result.error) {
            alert(result.error.message);
          }
        })
        .catch(function(error) {
          console.error('Error:', error);
        });          

For some reason i cant get access to " result " value in >>.then(function(result) << can anyone tell me whats values are available " result "?出于某种原因,我无法访问 >>.then(function(result) << 中的“result”值 << 谁能告诉我“result”可用的值有哪些?

While this is unlikely in most scenarios, you'd get back the result with an error and message as described .虽然这在大多数情况下不太可能发生,但您会返回包含error所述messageresult

You can test this using for example Chrome's.network throttling to simulate a.network failure.您可以使用例如 Chrome 的网络节流来模拟网络故障来对此进行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM