Skip to content

Instantly share code, notes, and snippets.

@1dolinski
Created August 15, 2016 23:34
Show Gist options
  • Save 1dolinski/60b39e6afae9391f08b5469651233845 to your computer and use it in GitHub Desktop.
Save 1dolinski/60b39e6afae9391f08b5469651233845 to your computer and use it in GitHub Desktop.
var stripe = require("stripe")(
"TEST_STRIPE_HERE"
);
class Charge {
constructor(opts = {}) {
this.amount = opts.amount;
this.currency = 'cad';
this.customer = opts.customer;
this.description = opts.description;
}
}
var customerId = 'CUSTOMER_ID_HERE'
var charge = new Charge({amount: 675, customer: customerId, description: 'works'})
stripe.charges.create(charge, function(err, charge) {
if(err) {
console.log(err);
return;
}
console.log(charge);
});
Error: Stripe: Unknown arguments ([object Object]). Did you mean to pass an options object? See https://github.com/stripe/stripe-node/wiki/Passing-Options. (on API request to POST function (outputs) {
return cleanString.replace(/\{([\s\S]+?)\}/g, function($0, $1) {
return encodeURIComponent(outputs[$1] || '');
});
})
at Object.create (/Users/singleTests/node_modules/stripe/lib/StripeMethod.js:64:17)
at Object.<anonymous> (/Users//singleTests/stripeCharge.js:16:16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment