Billing ও finance system-এর জন্য Invoice PDF API
Tax ও accounting logic আপনার system-এ রেখে billing data থেকে JSON Render বা Template Render দিয়ে সাধারণ invoice PDF তৈরি করুন।
/api/v1/pdf/render Billing, ERP বা SaaS system-এর invoice data-কে readable PDF invoice-এ রূপান্তর করুন, আর numbering, tax, payment state এবং accounting semantics caller-এর system-এর ভিতরেই রাখুন।
কখন এই API ব্যবহার করবেন
- Customer, receipt, statement বা accounting export-এর জন্য সাধারণ invoice PDF দরকার।
- আপনার system আগে থেকেই invoice number, tax calculation, line item এবং payment state own করে।
- Browser না চালিয়ে table, total, metadata এবং optional PDF/A setting চান।
- Repeated invoice layout-এর জন্য template_id contract চান।
এটি কী replace করে না
- Factur-X বা ZUGFeRD-এর মতো legal e-invoice package দরকার। E-Invoice Render ব্যবহার করুন।
- gPdf tax calculate করবে, accounting rule validate করবে বা payment reconcile করবে বলে আশা করছেন।
- Structured JSON বা template-এর বদলে arbitrary HTML invoice conversion চান।
কোন endpoint call করবেন
/api/v1/pdf/render
JSON Render এই workflow-এর default path।
/api/v1/template-render
Workflow-তে related API path, template contract অথবা capabilities lookup দরকার হলে ব্যবহার করুন।
/api/v1/e-invoice/render
Workflow-তে related API path, template contract অথবা capabilities lookup দরকার হলে ব্যবহার করুন।
নূন্যতম request
POST /api/v1/pdf/render - minimal invoice header ও total।
{
"pages": [
{
"size": "a4",
"elements": [
{
"type": "text",
"x": 20,
"y": 24,
"content": "Invoice INV-1007",
"style": { "font_size": 18, "font_family": "NotoSans-Regular" }
},
{
"type": "text",
"x": 20,
"y": 42,
"content": "Bill to: Example Customer\nAmount due: USD 245.00",
"style": { "font_size": 11, "font_family": "NotoSans-Regular" }
},
{
"type": "line",
"x1": 20,
"y1": 62,
"x2": 190,
"y2": 62
}
]
}
]
}
gPdf কী করে
- JSON page বা template data থেকে invoice PDF rendering।
- Text, table, total block, pagination, metadata এবং optional PDF/A output।
- একাধিক system-এ ব্যবহৃত stable invoice layout-এর জন্য Template Render।
- Binary PDF response এবং consistent API error envelope।
আপনার system-এর দায়িত্ব
- Invoice number, payment state, tax calculation, discount, credit এবং ledger meaning।
- Customer ও issuer data, line-item mapping, currency এবং rounding rule।
- Retention, delivery, email, payment link এবং accounting-system reconciliation।
Production checklist
- প্রতিটি visible invoice field source billing data-তে map হয়েছে কি না confirm করুন।
- Line-item overflow, long customer name, multi-page invoice এবং total test করুন।
- Layout JSON Render-এ থাকবে নাকি published template-এ থাকবে তা ঠিক করুন।
- সাধারণ invoice PDF generation-কে legal e-invoice packaging থেকে আলাদা রাখুন।
- আপনার invoice record-এর সাথে request ID এবং output filename store করুন।
দাবির সীমা
- সাধারণ invoice PDF legal e-invoice mandate-এর মতো নয়।
- gPdf invoice document render করে; tax বা accounting state calculate করে না।
- Factur-X / ZUGFeRD output POST /api/v1/e-invoice/render-এ থাকে।
সাধারণ invoice আর e-invoice-এর পার্থক্য
সাধারণ invoice PDF হলো আপনার customer যে document পড়ে। এটি JSON Render বা Template Render থেকে তৈরি হতে পারে। আপনার system invoice number, tax, line item, currency এবং payment state ঠিক করে, তারপর gPdf visible PDF render করে।
Legal e-invoice আলাদা। Factur-X এবং ZUGFeRD readable PDF/A-3b invoice-এর সঙ্গে
embedded EN 16931 CII XML যুক্ত করে। ওই package-এর জন্য
POST /api/v1/e-invoice/render ব্যবহার করুন।
Template Render সাধারণত production endpoint
Finance team সাধারণত চায় না প্রতিটি service invoice coordinate আবার তৈরি করুক।
Common path হলো invoice একবার design করা, template হিসেবে publish করা, এবং
caller-দের stable template_id plus data schema দেওয়া। Custom layout, internal
tool এবং template prototyping-এর জন্য JSON Render এখনো useful।
Accounting logic upstream রাখুন
gPdf-এ final display value পাঠানো উচিত, unresolved accounting decision নয়। Render API call করার আগে tax, discount, rounding, payment status এবং invoice eligibility compute করুন। এতে PDF output deterministic থাকে এবং financial system প্রামাণিক উৎস হিসেবে থাকে।
FAQ
- Invoice PDF কি e-invoice-এর মতো?
- না। সাধারণ invoice PDF human-readable output। Factur-X বা ZUGFeRD e-invoice PDF/A-3b wrapper-এর ভিতরে EN 16931 CII XML embed করে।
- Repeated invoice কোন endpoint ব্যবহার করবে?
- Invoice layout stable হলে এবং caller-দের শুধু template_id plus data পাঠানো উচিত হলে Template Render ব্যবহার করুন। Code layout own করলে JSON Render ব্যবহার করুন।
- gPdf কি tax calculate করে?
- না। Render data পাঠানোর আগে আপনার billing বা accounting system tax, total, discount এবং payment state calculate করে।
- Invoice PDF কি PDF/A ব্যবহার করতে পারে?
- হ্যাঁ, JSON Render PDF/A setting support করে। Invoice-কে Factur-X বা ZUGFeRD হিসেবে package করতে হলে নির্দিষ্টভাবে E-Invoice Render ব্যবহার করুন।