Advertisement
Guest User

Node try-catch

a guest
Sep 18th, 2019
91
0
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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement