简体   繁体   中英

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 "?

While this is unlikely in most scenarios, you'd get back the result with an error and message as described .

You can test this using for example Chrome's.network throttling to simulate a.network failure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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