Instantly share code, notes, and snippets.

Embed
What would you like to do?
var stripe = require('stripe')('sk_test_XXXX');
stripe.subscriptions.create({
customer: "cus_XXXXX",
plan: "testidreuse",
trial_end: 'now'
}, function(err, subscription) {
if(err) {
console.log("[ERROR] oops: ", err);
return;
}
console.log("subscription created: ", subscription);
stripe.subscriptions.update(
subscription.id,
{
coupon: "fakE",
trial_end: 'now'
},
function(err, subscription) {
if(err) {
console.log("[ERROR] oops2: ", err);
return;
}
console.log("subscription updated: ", subscription);
}
);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment