Router.route('/orders/charged', {
auth_required: true,
role_required: 'admin'
}, {
get: function () {
var Stripe = StripeAPI(process.env.STRIPE_KEY);
Stripe.events.list({
limit: 4,
type: 'charge.succeeded'
}).then(function (response) {
var orders = Orders.find({
_id: {
$in: _.map(response.data, function (data) {
return data.data.object.metadata.orderId;
});
}
}
}).fetch();
// welp. Now what?