Resources / Code Samples

Code Samples & Voorbeelden

Klaar-voor-gebruik code voorbeelden om uw integratie te versnellen

📄
Facturering

Maak Factuur met Items

Compleet voorbeeld van het maken van een factuur met regelitems en belasting berekening

JavaScript
Webhooks

Verwerk Betaling Webhook

Verwerk webhook events voor betaling processing en verificatie

Python
👥
Klanten

Klant Management

CRUD operaties voor klantrecords met Laravel integratie

PHP
📊
Rapporten

Genereer Financiële Rapporten

Maak PDF rapporten met charts en financiële samenvattingen

JavaScript
📋
Facturering

Bulk Factuur Creatie

Importeer en maak meerdere facturen van CSV bestand

Python
📧
Notificaties

Email Notificaties

Verstuur aangepaste email notificaties met factuur bijlagen

Ruby

Uitgelicht Voorbeeld

Complete Factuur Creatie Voorbeeld

Volledige workflow inclusief klant creatie, belasting berekening en email levering

// 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 Collecties

Aan de Slag

8 samples

Basis voorbeelden om u op weg te helpen

Geavanceerde Voorbeelden

15 samples

Complexe use cases en best practices

Integratie Patronen

12 samples

Veel voorkomende integratie scenario's

Community Bijdragen

Deel Uw Code Samples

Heeft u een nuttig code voorbeeld? Draag bij aan onze samples repository en help andere ontwikkelaars in de community.

Begin Sneller met Bouwen

Gebruik onze code samples om Laabam in minuten te integreren, niet uren