SHARE
TWEET

Node try-catch

a guest Sep 18th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var stripe = require("stripe")("sk_test_GFdAiDDtbC7P2jcY5UlHYANz");
  2.  
  3.  
  4. async function thisErrors() {
  5.     return stripe.paymentIntents.create({
  6.         amount: 100,
  7.         currency: "usd",
  8.         payment_method: "pm_card_authenticationRequiredOnSetup",
  9.         confirm: true,
  10.         off_session: true,
  11.     });
  12. }
  13.  
  14. try {
  15.     cus = await thisErrors();
  16.     console.log("cus is:");
  17.     console.log(cus);
  18. }
  19. catch(e) {
  20.     console.log(e);
  21.     console.log(e.message);
  22.     console.log("decline code:");
  23.     console.log(e.raw.decline_code);
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top