This is a guest post from one of our users, Tim Gunter, Senior Systems Analyst at Vanilla Forums. Tim caught my attention with a recent tweet that read (and I quote), “I. Love. @SendGrid. Parse API so damned fantastic, I want to get an “I <3 Parse API” tattoo on my FREAKING FACE!” Later that night, our API had Tim feeling like the “Lord of the internets”.
As soon as I saw this, I had to learn more about the experience that inspired such excitement, and within hours Tim had sent me the story below…
Vanilla currently uses an external payment gateway (lets call them Acme Pay) to handle online payment processing for our hosted plans. It is pretty standard as far as mainstream “old school” payment processers go (not “new school” like Stripe, Braintree or Zuora). The API is fairly clunky and unpolished, but it gets the job done.
One big drawback I discovered with Acme Pay is that they do not support http “callbacks” to our system, to report on things like successful/failed payments, cancellations, refunds, etc. Obviously the lack of callbacks makes the system far more difficult to manage and track. We have to poll the gateway frequently and ask the equivalent of: “hey, anything cool happening?”. This is very frustrating, but it doesn’t end there. It seems that in addition to a lack of callbacks, Acme Pay does not store actual unique records of failed payment attempts. So that data simply doesn’t exist.
I called them up and discovered that the one thing they CAN do is send emails, either to us (the merchant) or to the client, (or both) whenever a payment succeeds or fails. Ordinarily this would be nearly useless to us, since we were looking for more automation, not another manual step (receive email, look up client, manually update their records). Emails sounded like a big hassle, and we weren’t getting anywhere. Time was ticking on and the processor was still not in a working state.
Introducing SendGrid Parse Incoming! I set up a custom domain name for billing emails and made it point to sendgrid.net. Then, I configured our SendGrid account to ping my payment processing code on a specific URL whenever any email was received on that domain. Not only do we get pinged, bur we receive a whole host of valuable information about the email in question, everything from common fields like ‘from’ and ‘to’ pre-parsed, to multiple versions of the email (with and without markup).
The code looks at the “to” address ([email protected]), extracts the username portion and interprets it as a processor name (‘acmepay’, in this case). It checks that such a processor exists (our system supports multiple processors), then fires an internal event, simulating an http request, to our payment code’s actual callback handler. It passes in the body of the email ([text], specifically) as the arguments/passed parameters.
And voila! Using the power of the Parse API, we have turned a deficiency with our payment processor into a cool integration that solves our problems and, interestingly, improves our customers’ experience at the same time.
Thanks to this integration, we can also now also send our own payment confirmation emails to customers instead of allowing the processor to handle that. As you can imagine, considering the fact that I was able to easily parse those emails for relevant information, they could not have looked pretty. In fact they were nothing more than plaintext key/value pair lists. Kinda gross, and not something one wants their customers to see.
So, thank you guys for such a freaking awesome product that Just Works and is super simple.
SendGrid turns my frown upside down
Well, all we can say is, “You’re welcome!” And we must thank Tim and the team at Vanilla for sharing their story. We hope it inspires other developers in the SendGrid Developer Community to use our APIs in innovative ways to solve the big problems that they face on a daily basis…oh yeah, and to strive to be the next Lord of the Internets.
“Vanilla is forum software that powers discussions on over 500,000 sites. Built to be flexible and scalable, and with theming/integration firmly in mind, Vanilla is one of the most powerful community solutions in the world.”
Community Guy @SendGrid and Producer @BoulderBeta. Passionate about bringing people together around things they love. Leads the SendGrid Developer Relations team in their effort to help developers around the world do more with email.