Stripe + MailKite
Stripe processes payments. Use MailKite to receive inbound email — customer receipts, charge disputes, and payment notifications — and forward them to your own processing pipeline, or use MailKite's SMTP to send branded receipts from your own domain.
What you need
- A verified domain with SPF + DKIM published
- Your API key (
mk_live_…) - Stripe account
How it works
MailKite receives inbound email (e.g., receipt forwards, dispute notifications) and processes them via a webhook handler. You can also replace Stripe's default email sending with MailKite SMTP for branded delivery. The handler detects receipt and dispute emails by subject line keywords.
Set up the webhook
Deploy this handler as a serverless function or worker. It classifies inbound Stripe emails as receipts or disputes and routes them accordingly. Extend it to post to Slack, create accounting entries, or trigger internal workflows.
// Stripe receipt/dispute email handler
// Receives forwarded receipts or charge notifications
async function handleInbound(email) {
const subject = email.subject || '';
// Detect receipt forwards
if (subject.toLowerCase().includes('receipt') || subject.toLowerCase().includes('payment')) {
console.log(`Payment email from ${email.from}: ${subject}`);
// Log to your accounting system, forward to finance, etc.
}
// Detect dispute notifications
if (subject.toLowerCase().includes('dispute') || subject.toLowerCase().includes('chargeback')) {
console.log(`Dispute alert: ${subject}`);
// Alert your team via Slack, create a ticket, etc.
}
return { ok: true };
} Receive inbound email
Configure your MailKite domain's webhook URL to point at your handler. Every inbound email delivers this payload:
from— sender addressto— recipient addresssubject— email subjecttext— plain text bodyhtml— HTML bodyattachments— array of file objects
Test it
curl -X POST https://your-worker.example.com/mailkite-inbound \
-H "Content-Type: application/json" \
-d '{"from":"receipts@stripe.com","to":"payments@yourdomain.com","subject":"Your receipt from Acme Inc","text":"Payment of $49.00 received."}' Troubleshooting
- Stripe sends receipts from
receipts@stripe.comby default; configure Stripe to send to an address on your MailKite domain to receive and re-route them. - For real-time payment events, use Stripe Webhooks (not email) — email is better for receipt forwarding and dispute alerts.
- The handler uses simple keyword matching; extend the subject parsing if your Stripe emails use custom templates.
See the SMTP relay docs for connection details, or Inbound webhooks for the full payload.