Skip to content

Instantly share code, notes, and snippets.

<?php
// SETUP:
// 1. Customize all the settings (stripe api key, email settings, email text)
// 2. Put this code somewhere where it's accessible by a URL on your server.
// 3. Add the URL of that location to the settings at https://manage.stripe.com/#account/webhooks
// 4. Have fun!
// set your secret key: remember to change this to your live secret key in production
// see your keys here https://manage.stripe.com/account
var conn = new Mongo();
db = conn.getDB(<DB_NAME>);
var cursor = db.<COLLECTION>.find();
var items = [];
items = cursor.toArray();
var dbstruc = {};
for (var i = 0; i < items.length; ++i) {
var target = items[i];
getKP(target,dbstruc);
}