Skip to main content
📞 1-888-784-3881🚀 Start Project
💳Integrations

Stripe Payments

Accept payments and manage subscriptions.

⏱️ 15 min read

Overview

Integrate Stripe to accept payments for services, earnest money deposits, or subscription billing.

Setup

1. Connect Stripe Account

// Initialize with Stripe keys

const proptech = new PropTech({

apiKey: process.env.PROPTECH_API_KEY,

stripe: {

secretKey: process.env.STRIPE_SECRET_KEY,

webhookSecret: process.env.STRIPE_WEBHOOK_SECRET,

},

});

const paymentLink = await proptech.payments.createLink({

leadId: 'lead_abc123',

amount: 500000, // $5,000 in cents

description: 'Earnest Money Deposit',

metadata: {

property: '123 Main St',

},

});

// Send to lead

console.log(paymentLink.url);

Checkout Sessions

const session = await proptech.payments.createCheckout({

leadId: 'lead_abc123',

lineItems: [

{

name: 'Earnest Money Deposit',

amount: 500000,

quantity: 1,

},

],

successUrl: 'https://yourdomain.com/success',

cancelUrl: 'https://yourdomain.com/cancel',

});

Handling Webhooks

// app/api/webhooks/stripe/route.ts

export async function POST(request: Request) {

const event = await proptech.payments.handleWebhook(

await request.text(),

request.headers.get('stripe-signature')

);

switch (event.type) {

case 'payment_intent.succeeded':

// Mark deposit as received

await proptech.leads.update(event.data.metadata.leadId, {

depositReceived: true,

depositAmount: event.data.amount,

});

break;

}

return new Response('OK');

}