Get your API key
All integrations Payments

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

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-webhook.js
// 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 address
  • to — recipient address
  • subject — email subject
  • text — plain text body
  • html — HTML body
  • attachments — array of file objects

Test it

test
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.com by 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.