简体   繁体   中英

Stripe Node js charge a customer

All I am trying to do is charge a customer like this:

var stripe = require("stripe")("sk_test_5uwvjas5uFYUCZN5d3YdAT19");

stripe.charges.create({
  amount: 1000,
 currency: "usd",
 customer: "cus_112121212", // CUSTOMER ID
 destination: {
          account: "{CONNECTED_STRIPE_ACCOUNT_ID}",
      },
}).then(function(charge) {
 // asynchronously called
});

According to the documentation:

https://stripe.com/docs/api/charges/create This should be possible, Yet i get the error:

there was an issue Error: No such token: cus_111212122112

Am I reading the docs wrong? Thank you.

Review Firestripe example since it's in Node js.

https://github.com/firebase/functions-samples/blob/master/stripe/functions/index.js

If that doesn't help, confirm that customer have a source attached to it. If not, then you can't charge that customer.

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