View the Github Project. View all of the files, fork the project and deploy to Heroku in a few clicks.
const stripeConnectorId = "<ENTER_YOUR_ZENATON_STRIPE_CONNECTOR_ID>";
const sendgridConnectorId = "<ENTER_YOUR_ZENATON_SENDGRID_CONNECTOR_ID>";
let stripe = null;
let sendgrid = null;
module.exports.handle = function* ({ email, amount, currency, template_id }) {
stripe = this.connector("stripe", stripeConnectorId);
sendgrid = this.connector("sendgrid", sendgridConnectorId);
// Create a charge on Stripe
yield stripe.post("/charges", {
body: `currency=${currency}&amount=${amount}&source=tok_visa&receipt_email=${email}`
});
// Send email with Sendgrid
yield sendgrid.post("/mail/send", {
body: {
personalizations: [
{
to: [{ email: email }],
dynamic_template_data: { email, amount, currency, subject }
}
],
template_id: template_id,
from: { email: "order@myshop.com" }
}
});
};
A workflow instance is launched with the following input.\ A workflow can be launched using the quick launch button on the sandbox or via http.
[
{
"email": "john@gmail.com",
"amount": "4000",
"currency": "usd",
"template_id": "34"
}
]
If you don't already have a stripe account, you can create a test account at Stripe.com. You will need your Stripe test API keys, and secret key to create the API connector on Zenaton.
This is a simple workflow to get you started with Zenaton but can be modified for more complicated logic.
View the Github Project. __View all of the files, fork the project and deploy to Heroku in a few clicks. Or run it in the online sandbox without needing to install Zenaton.
Sample Projects
Start building workflows
Sign-up and run a sample project Learn more