npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fatura

v0.2.1

Published

GİB eFatura.gov.tr Fatura Oluşturucu

Readme

🧾 Fatura.js

eArşiv sistemi üzerinde fatura oluşturmanızı sağlar.

Alternatifler

| Dil | Repo | Geliştirici | | --- | --------------------------------------------------- | --------------- | | PHP | https://github.com/AdemAliDurmus/fatura | Adem Ali Durmuş | | PHP | https://github.com/furkankadioglu/efatura | Furkan Kadıoğlu | | PHP | https://github.com/mlevent/fatura | Mert Levent | | C# | https://github.com/BFYDigital/e-arsiv-fatura-dotnet | BFY Digital |

Bu sistem https://earsivportal.efatura.gov.tr/ adresini kullanarak bu sistem üzerinden fatura oluşturmanızı sağlar.

Bu sistem GİB'e tabi şahıs şirketi ya da şirket hesapları ile çalışır ve bu kişilikler adına resmi fatura oluşturur. Kesilen faturaları https://earsivportal.efatura.gov.tr/ adresinden görüntüleyebilir ya da bu kütüphane ile indirebilirsiniz.

Kullanıcı Adı ve Parola Bilgileri

https://earsivportal.efatura.gov.tr/intragiris.html adresindeki parola ekranında kullanılan kullanıcı kodu ve parola ile bu paketi kullanabilirsiniz. ℹ️ Bu kullanıcı kodu ve parola bilgilerini muhasebecinizden ya da GİB - İnteraktif Vergi Dairesi'nden edinebilirsiniz.

Yükleme

npm install fatura

Node.js 18 veya üzeri gereklidir (package.json içinde engines).

Kullanım

Tüm işlemler bir FaturaClient örneği üzerinden yapılır. Üretim (canlı GİB) için:

const { createFaturaClient } = require("fatura");
const client = createFaturaClient(); // varsayılan: PROD

Test ortamı (https://earsivportaltest.efatura.gov.tr):

const client = createFaturaClient("TEST");

ES modülü:

import { createFaturaClient } from "fatura";
const client = createFaturaClient();

Oldukça kolay bir kullanıma sahiptir:

createInvoiceAndGetDownloadURL(user, pass, invoice, { sign })

Bu method ile fatura oluşturulup imzalanır ve indirme adresi döner.

const { createFaturaClient } = require("fatura");

const client = createFaturaClient();

const faturaURL = await client.createInvoiceAndGetDownloadURL(
    "GIB Kullanıcı Adı",
    "GIB Parolası",
    {
        ...faturaDetayları,
    },
    // Varsayılan olarak sign: true gönderilir.
    { sign: false },
);

createInvoiceAndGetHTML(user, pass, invoice, { sign })

Bu method ile fatura oluşturulup imzalanır ve fatura HTML'i döner. Bu HTML'i iframe içerisinde gösterip yazdırılmasını sağlayabilirsiniz.

const { createFaturaClient } = require("fatura");

const client = createFaturaClient();

const faturaHTML = await client.createInvoiceAndGetHTML(
    "GIB Kullanıcı Adı",
    "GIB Parolası",
    {
        ...faturaDetayları,
    },
    // Varsayılan olarak sign: true gönderilir.
    { sign: false },
);

Diğer metodlar (client üzerinde)

Aşağıdakilerin tümü const client = createFaturaClient(...) ile oluşturduğunuz istemci üzerinde çağrılır.

getToken(user, pass)

e-Arşiv Portal oturumu için token döner.

createDraftInvoice(token, invoiceDetails)

e-Arşiv’de önce taslak oluşturulur. Dönüş değerinde uuid, date ve GİB cevabı bulunur. invoiceDetails örnek şekli:

ℹ️ uuid vermezseniz yeni bir UUID atanır.

{
    uuid: "4c72cb57-b72d-4812-ac48-0a0bce83e771",

    date: "08/02/2020",
    time: "09:07:48",
    taxIDOrTRID: "11111111111",
    taxOffice: "Beylikduzu",
    title: "FATIH AKIN",
    name: "",
    surname: "",
    fullAddress: "X Sok. Y Cad. No: 3 Z Istanbul",
    items: [
        {
            name: "Stickker",
            quantity: 1,
            unitPrice: 100,
            price: 100,
            VATRate: 20,
            VATAmount: 20,
        },
    ],
    totalVAT: 20,
    grandTotal: 100.0,
    grandTotalInclVAT: 120.0,
    paymentTotal: 120.0,
}

findInvoice(token, draftInvoice)

createDraftInvoice’ın döndürdüğü taslak nesnesi (date + uuid içeren) verilir; ilgili gündeki taslaklar arasından eşleşen kayıt döner. İmzalama için gereken bilgiler (ör. belge numarası) bu nesnede yer alır.

getAllInvoicesByDateRange(token, { startDate, endDate })

İki tarih arasındaki kesilen / taslak listesi (GİB komutuna göre).

getAllInvoicesIssuedToMeByDateRange(token, { startDate, endDate })

İki tarih arasındaki adıma düzenlenen belgeler.

signDraftInvoice(token, draftInvoice)

☢️ İmzalama kesilmiş sayılan mali işlem oluşturur; dikkatli kullanın.

findInvoice ile bulunan liste öğesi (draftInvoice formatı) verilmelidir.

getDownloadURL(token, invoiceUUID, { signed })

İndirme URL’si döner (.zip içinde HTML/XML olabilir). signed: fatura onaylı mı (true / false).

getInvoiceHTML(token, uuid, { signed })

Fatura HTML metni. signed imzalı/onaysız görünüm için kullanılır.

cancelDraftInvoice(token, reason, draftInvoice)

Taslak iptali.

getRecipientDataByTaxIDOrTRID(token, taxIDOrTRID)

VKN/TCKN ile alıcı bilgisi sorgusu.

sendSignSMSCode / verifySignSMSCode

İmzaya ilişkin SMS doğrulama akışı (GİB kurallarına tabi).

getUserData / updateUserData

Portal kullanıcı bilgilerini okuma / güncelleme.

createInvoice(user, pass, invoiceDetails, { sign })

Token alır, taslak oluşturur, bulur; sign: true (varsayılan) ise imzalar. findInvoice sonuç vermezse imza atlanır.

logout(token)

Oturum kapatma; GİB cevabına göre dönüş tipi değişebilir.

Lisans

MIT


☢️ BU PAKET VERGİYE TABİ OLAN MALİ VERİ OLUŞTURUR. BU PAKET NEDENİYLE OLUŞABİLECEK SORUNLARDAN BU PAKET SORUMLU TUTULAMAZ, RİSK KULLANANA AİTTİR. RİSKLİ GÖRÜYORSANIZ KULLANMAYINIZ.