संसाधन / Code Samples

Code Samples और उदाहरण

अपने एकीकरण को तेज करने के लिए उपयोग के लिए तैयार कोड उदाहरण

📄
Invoicing

आइटम के साथ चालान बनाएं

लाइन आइटम और कर गणना के साथ चालान बनाने का संपूर्ण उदाहरण

JavaScript
Webhooks

Payment Webhook प्रोसेस करें

भुगतान प्रोसेसिंग और सत्यापन के लिए webhook इवेंट्स को हैंडल करें

Python
👥
Customers

ग्राहक प्रबंधन

Laravel एकीकरण के साथ ग्राहक रिकॉर्ड के लिए CRUD operations

PHP
📊
Reports

वित्तीय रिपोर्ट जनरेट करें

charts और वित्तीय सारांश के साथ PDF रिपोर्ट बनाएं

JavaScript
📋
Invoicing

थोक चालान निर्माण

CSV फ़ाइल से कई चालान इंपोर्ट और बनाएं

Python
📧
Notifications

ईमेल सूचनाएं

चालान अटैचमेंट के साथ कस्टम ईमेल सूचनाएं भेजें

Ruby

फीचर्ड उदाहरण

संपूर्ण चालान निर्माण उदाहरण

ग्राहक निर्माण, कर गणना, और ईमेल डिलीवरी सहित पूर्ण वर्कफ़्लो

// Invoice Creation with Tax Calculation
const Laabam = require('laabam-sdk');
const laabam = new Laabam(process.env.LAABAM_API_KEY);

async function createInvoiceWithTax() {
  try {
    // Create customer if doesn't exist
    const customer = await laabam.customers.create({
      name: "Acme Corporation",
      email: "billing@acme.com",
      phone: "+91-9876543210",
      gstin: "29ABCDE1234F1Z5"
    });

    // Prepare invoice items
    const items = [
      {
        description: "Professional Services - Month 1",
        quantity: 1,
        rate: 50000,
        tax_rate: 18 // GST 18%
      },
      {
        description: "Consulting Hours",
        quantity: 40,
        rate: 1500,
        tax_rate: 18
      }
    ];

    // Calculate totals
    const subtotal = items.reduce((sum, item) => 
      sum + (item.quantity * item.rate), 0
    );
    const tax = subtotal * 0.18;
    const total = subtotal + tax;

    // Create invoice
    const invoice = await laabam.invoices.create({
      customer_id: customer.id,
      invoice_date: new Date().toISOString().split('T')[0],
      due_date: new Date(Date.now() + 30*24*60*60*1000)
        .toISOString().split('T')[0],
      items: items,
      subtotal: subtotal,
      tax: tax,
      total: total,
      currency: "INR",
      notes: "Payment due within 30 days"
    });

    console.log(`Invoice created: ${invoice.id}`);
    console.log(`Total amount: ₹${total}`);

    // Send invoice via email
    await laabam.invoices.send(invoice.id, {
      to: customer.email,
      subject: `Invoice #${invoice.invoice_number}`,
      message: "Thank you for your business!"
    });

    return invoice;
  } catch (error) {
    console.error('Error creating invoice:', error);
    throw error;
  }
}

createInvoiceWithTax();

Sample Collections

शुरूआत करना

8 samples

आपको शुरू करने के लिए मूल उदाहरण

उन्नत उदाहरण

15 samples

जटिल उपयोग मामले और सर्वोत्तम प्रथाएं

एकीकरण पैटर्न

12 samples

सामान्य एकीकरण परिदृश्य

कम्युनिटी योगदान

अपने Code Samples साझा करें

कोई उपयोगी कोड उदाहरण है? हमारे samples repository में योगदान दें और कम्युनिटी में अन्य डेवलपर्स की मदद करें।

तेज़ी से बनाना शुरू करें

घंटों नहीं, मिनटों में Laabam को एकीकृत करने के लिए हमारे code samples का उपयोग करें