Egy partially-refunded eseményre az issueForPayment() visszatérítésenként egy módosító számlát állít ki a fizetés számlájához. Ehhez ledger kell: egy setIfAbsent-et ismerő tároló. A Billingo módosító számlájának ugyanis nincs vendorId-ja, és a bizonylatlista 15–30 másodpercet késik, így egy újraküldött webhook a Billingóból nem látná, hogy a módosító már elkészült.
Részleges visszatérítésre módosító számla ledgerrel; az újraküldött esemény nem állít ki másodikat.
Futtatás a sandboxbanimport { } from 'tarcajs'
import { , type PaymentEvent } from 'tarcajs/payments'
import { } from 'tarcajs/stores'
const = ()
const = ()
const : PaymentEvent = {
: 'stripe',
: 'paid',
: 'pi_3QhB7d',
: 'stripe',
: { : 25_400, : 2_540_000, : 'HUF' },
: {
: 'Vevő Kft.',
: '12345678-2-42',
: { : 'HU', : '1111', : 'Budapest', : 'Fő utca 1.' },
},
: {},
}
const : PaymentEvent = {
...,
: 'partially-refunded',
: [{ : 're_1', : { : 5_000, : 500_000, : 'HUF' } }],
}
const = await (, , { : 27 })
const = await (, , { : 27, })
const = await (, , { : 27, })
if (. === 'invoice') .('számla:', ..)
if (. === 'modification' && . === 'modification') {
.('módosító számla:', .[0]?., .)
.('újraküldött esemény:', .[0]?., .)
.('bruttó:', .[0]?.)
}GET /documents/vendor/STRIPE-pi_3QhB7d HTTP/1.1GET /documents/vendor/STRIPE-pi_3QhB7d HTTP/1.1GET /document-blocks?per_page=100&type=invoice HTTP/1.1GET /partners?page=1&per_page=100&query=Vevő Kft. HTTP/1.1POST /partners HTTP/1.1
content-type: application/json
{
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"taxcode": "12345678-2-42",
"tax_type": "HAS_TAX_NUMBER"
}POST /documents HTTP/1.1
content-type: application/json
{
"vendor_id": "STRIPE-pi_3QhB7d",
"type": "invoice",
"fulfillment_date": "2026-11-16",
"due_date": "2026-11-24",
"payment_method": "stripe",
"language": "hu",
"currency": "HUF",
"electronic": false,
"items": [
{
"name": "Termék vagy szolgáltatás",
"quantity": 1,
"unit": "db",
"vat": "27%",
"unit_price": 25400,
"unit_price_type": "gross"
}
],
"settings": {
"should_send_email": false
},
"block_id": 1,
"partner_id": 1
}PUT /documents/1/payments HTTP/1.1
content-type: application/json
[
{
"date": "2026-11-16",
"price": 25400,
"payment_method": "stripe"
}
]GET /documents/vendor/STRIPE-pi_3QhB7d HTTP/1.1GET /documents/1 HTTP/1.1GET /documents?page=1&per_page=100&partner_id=1&start_date=2026-11-16 HTTP/1.1POST /documents/1/create-modification-document HTTP/1.1
content-type: application/json
{
"comment": "(Visszatérítés STRIPE-pi_3QhB7d re_1)",
"payment_method": "stripe",
"items": [
{
"name": "Termék vagy szolgáltatás",
"quantity": 1,
"unit": "db",
"vat": "27%",
"unit_price": -5000,
"unit_price_type": "gross"
}
]
}GET /documents/vendor/STRIPE-pi_3QhB7d HTTP/1.1HTTP/1.1 404
content-type: application/json
{
"error": {
"message": "Document is not found."
}
}HTTP/1.1 404
content-type: application/json
{
"error": {
"message": "Document is not found."
}
}HTTP/1.1 200
content-type: application/json
{
"total": 1,
"per_page": 100,
"current_page": 1,
"last_page": 1,
"prev_page_url": null,
"next_page_url": null,
"data": [
{
"id": 1,
"name": "Számlák",
"prefix": "",
"custom_field1": "",
"custom_field2": "",
"type": "invoice"
}
]
}HTTP/1.1 200
content-type: application/json
{
"total": 0,
"per_page": 100,
"current_page": 1,
"last_page": 1,
"prev_page_url": null,
"next_page_url": null,
"data": []
}HTTP/1.1 201
content-type: application/json
{
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "12345678-2-42",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"general_ledger_number": "",
"tax_type": "HAS_TAX_NUMBER",
"custom_billing_settings": {
"payment_method": null,
"document_form": null,
"due_days": null,
"document_currency": null,
"template_language_code": null,
"discount": null,
"custom_label": null
},
"group_member_tax_number": "",
"giro_settings": {
"giro_default_settings": true,
"giro_payment_request_enabled": false,
"giro_different_amount_allowed": false
},
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
},
"internal_comment": "",
"partner_show_type": "show_all"
}HTTP/1.1 201
content-type: application/json
{
"id": 1,
"invoice_number": "2026-1",
"type": "invoice",
"cancelled": false,
"block_id": 1,
"payment_status": "outstanding",
"payment_method": "stripe",
"gross_total": 25400,
"currency": "HUF",
"conversion_rate": 1,
"invoice_date": "2026-11-16",
"fulfillment_date": "2026-11-16",
"due_date": "2026-11-24",
"paid_date": "2026-11-16",
"organization": {
"name": "Hamis Billingo teszt szervezet",
"tax_number": "00000000-0-00",
"bank_account": {
"id": null,
"name": "",
"account_number": "",
"account_number_iban": "",
"swift": ""
},
"address": {
"country_code": "HU",
"post_code": "1011",
"city": "Budapest",
"address": "Fő utca 1."
},
"small_taxpayer": false,
"ev_number": "",
"eu_tax_number": "",
"cash_settled": false
},
"partner": {
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "12345678-2-42",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"general_ledger_number": "",
"tax_type": "HAS_TAX_NUMBER",
"custom_billing_settings": {
"payment_method": null,
"document_form": null,
"due_days": null,
"document_currency": null,
"template_language_code": null,
"discount": null,
"custom_label": null
},
"group_member_tax_number": "",
"giro_settings": {
"giro_default_settings": true,
"giro_payment_request_enabled": false,
"giro_different_amount_allowed": false
},
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
},
"internal_comment": "",
"partner_show_type": null
},
"document_partner": {
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "12345678-2-42",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"tax_type": "HAS_TAX_NUMBER",
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
}
},
"electronic": false,
"comment": "",
"tags": [],
"notification_status": "none",
"language": "hu",
"items": [
{
"product_id": null,
"name": "Termék vagy szolgáltatás",
"net_unit_amount": 20000.000001,
"quantity": 1,
"unit": "db",
"net_amount": 20000,
"gross_amount": 25400,
"vat": "27%",
"vat_amount": 5400,
"entitlement": null,
"comment": "",
"sku": null,
"data_eraser_codes": null,
"is_deposit_fee": false,
"ean": null,
"is_connect_product": false,
"connected_item": null,
"connect_document_item_setting": null
}
],
"summary": {
"net_amount": 20000,
"net_amount_local": 20000,
"gross_amount_local": 25400,
"vat_amount": 5400,
"vat_amount_local": 5400,
"vat_rate_summary": [
{
"vat_name": "27%",
"vat_percentage": 0.27,
"vat_rate_net_amount": 20000,
"vat_rate_vat_amount": 5400,
"vat_rate_vat_amount_local": 5400,
"vat_rate_gross_amount": 25400
}
]
},
"settings": {
"mediated_service": false,
"without_financial_fulfillment": false,
"online_payment": "no",
"should_send_email": false,
"round": "none",
"no_send_onlineszamla_by_user": false,
"dont_send_to_nav_reason": null,
"order_number": "",
"place_id": null,
"instant_payment": true,
"selected_type": null,
"instant_payment_request": null,
"is_waybill_hide_prices": false
},
"online_szamla_status": "processing",
"kobak_receipt_status": null,
"kobak_receipt_message": null,
"related_documents": [],
"discount": null,
"correction_type": "invoice",
"recurring_id": null
}HTTP/1.1 200
content-type: application/json
[
{
"date": "2026-11-16",
"price": 25400,
"payment_method": "stripe",
"voucher_number": "",
"conversion_rate": 1
}
]HTTP/1.1 200
content-type: application/json
{
"id": 1,
"invoice_number": "2026-1",
"type": "invoice",
"cancelled": false,
"block_id": 1,
"payment_status": "paid",
"payment_method": "stripe",
"gross_total": 25400,
"currency": "HUF",
"conversion_rate": 1,
"invoice_date": "2026-11-16",
"fulfillment_date": "2026-11-16",
"due_date": "2026-11-24",
"paid_date": "2026-11-16",
"organization": {
"name": "Hamis Billingo teszt szervezet",
"tax_number": "00000000-0-00",
"bank_account": {
"id": null,
"name": "",
"account_number": "",
"account_number_iban": "",
"swift": ""
},
"address": {
"country_code": "HU",
"post_code": "1011",
"city": "Budapest",
"address": "Fő utca 1."
},
"small_taxpayer": false,
"ev_number": "",
"eu_tax_number": "",
"cash_settled": false
},
"partner": {
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "12345678-2-42",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"general_ledger_number": "",
"tax_type": "HAS_TAX_NUMBER",
"custom_billing_settings": {
"payment_method": null,
"document_form": null,
"due_days": null,
"document_currency": null,
"template_language_code": null,
"discount": null,
"custom_label": null
},
"group_member_tax_number": "",
"giro_settings": {
"giro_default_settings": true,
"giro_payment_request_enabled": false,
"giro_different_amount_allowed": false
},
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
},
"internal_comment": "",
"partner_show_type": null
},
"document_partner": {
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "12345678-2-42",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"tax_type": "HAS_TAX_NUMBER",
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
}
},
"electronic": false,
"comment": "",
"tags": [],
"notification_status": "none",
"language": "hu",
"items": [
{
"product_id": null,
"name": "Termék vagy szolgáltatás",
"net_unit_amount": 20000.000001,
"quantity": 1,
"unit": "db",
"net_amount": 20000,
"gross_amount": 25400,
"vat": "27%",
"vat_amount": 5400,
"entitlement": null,
"comment": "",
"sku": null,
"data_eraser_codes": null,
"is_deposit_fee": false,
"ean": null,
"is_connect_product": false,
"connected_item": null,
"connect_document_item_setting": null
}
],
"summary": {
"net_amount": 20000,
"net_amount_local": 20000,
"gross_amount_local": 25400,
"vat_amount": 5400,
"vat_amount_local": 5400,
"vat_rate_summary": [
{
"vat_name": "27%",
"vat_percentage": 0.27,
"vat_rate_net_amount": 20000,
"vat_rate_vat_amount": 5400,
"vat_rate_vat_amount_local": 5400,
"vat_rate_gross_amount": 25400
}
]
},
"settings": {
"mediated_service": false,
"without_financial_fulfillment": false,
"online_payment": "no",
"should_send_email": false,
"round": "none",
"no_send_onlineszamla_by_user": false,
"dont_send_to_nav_reason": null,
"order_number": "",
"place_id": null,
"instant_payment": true,
"selected_type": null,
"instant_payment_request": null,
"is_waybill_hide_prices": false
},
"online_szamla_status": "processing",
"kobak_receipt_status": null,
"kobak_receipt_message": null,
"related_documents": [],
"discount": null,
"correction_type": "invoice",
"recurring_id": null
}HTTP/1.1 200
content-type: application/json
{
"id": 1,
"invoice_number": "2026-1",
"type": "invoice",
"cancelled": false,
"block_id": 1,
"payment_status": "paid",
"payment_method": "stripe",
"gross_total": 25400,
"currency": "HUF",
"conversion_rate": 1,
"invoice_date": "2026-11-16",
"fulfillment_date": "2026-11-16",
"due_date": "2026-11-24",
"paid_date": "2026-11-16",
"organization": {
"name": "Hamis Billingo teszt szervezet",
"tax_number": "00000000-0-00",
"bank_account": {
"id": null,
"name": "",
"account_number": "",
"account_number_iban": "",
"swift": ""
},
"address": {
"country_code": "HU",
"post_code": "1011",
"city": "Budapest",
"address": "Fő utca 1."
},
"small_taxpayer": false,
"ev_number": "",
"eu_tax_number": "",
"cash_settled": false
},
"partner": {
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "12345678-2-42",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"general_ledger_number": "",
"tax_type": "HAS_TAX_NUMBER",
"custom_billing_settings": {
"payment_method": null,
"document_form": null,
"due_days": null,
"document_currency": null,
"template_language_code": null,
"discount": null,
"custom_label": null
},
"group_member_tax_number": "",
"giro_settings": {
"giro_default_settings": true,
"giro_payment_request_enabled": false,
"giro_different_amount_allowed": false
},
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
},
"internal_comment": "",
"partner_show_type": null
},
"document_partner": {
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "12345678-2-42",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"tax_type": "HAS_TAX_NUMBER",
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
}
},
"electronic": false,
"comment": "",
"tags": [],
"notification_status": "none",
"language": "hu",
"items": [
{
"product_id": null,
"name": "Termék vagy szolgáltatás",
"net_unit_amount": 20000.000001,
"quantity": 1,
"unit": "db",
"net_amount": 20000,
"gross_amount": 25400,
"vat": "27%",
"vat_amount": 5400,
"entitlement": null,
"comment": "",
"sku": null,
"data_eraser_codes": null,
"is_deposit_fee": false,
"ean": null,
"is_connect_product": false,
"connected_item": null,
"connect_document_item_setting": null
}
],
"summary": {
"net_amount": 20000,
"net_amount_local": 20000,
"gross_amount_local": 25400,
"vat_amount": 5400,
"vat_amount_local": 5400,
"vat_rate_summary": [
{
"vat_name": "27%",
"vat_percentage": 0.27,
"vat_rate_net_amount": 20000,
"vat_rate_vat_amount": 5400,
"vat_rate_vat_amount_local": 5400,
"vat_rate_gross_amount": 25400
}
]
},
"settings": {
"mediated_service": false,
"without_financial_fulfillment": false,
"online_payment": "no",
"should_send_email": false,
"round": "none",
"no_send_onlineszamla_by_user": false,
"dont_send_to_nav_reason": null,
"order_number": "",
"place_id": null,
"instant_payment": true,
"selected_type": null,
"instant_payment_request": null,
"is_waybill_hide_prices": false
},
"online_szamla_status": "processing",
"kobak_receipt_status": null,
"kobak_receipt_message": null,
"related_documents": [],
"discount": null,
"correction_type": "invoice",
"recurring_id": null
}HTTP/1.1 200
content-type: application/json
{
"total": 1,
"per_page": 100,
"current_page": 1,
"last_page": 1,
"prev_page_url": null,
"next_page_url": null,
"data": [
{
"id": 1,
"invoice_number": "2026-1",
"type": "invoice",
"cancelled": false,
"block_id": 1,
"payment_status": "paid",
"payment_method": "stripe",
"gross_total": 25400,
"currency": "HUF",
"conversion_rate": 1,
"invoice_date": "2026-11-16",
"fulfillment_date": "2026-11-16",
"due_date": "2026-11-24",
"paid_date": "2026-11-16",
"organization": {
"name": "Hamis Billingo teszt szervezet",
"tax_number": "00000000-0-00",
"bank_account": {
"id": null,
"name": "",
"account_number": "",
"account_number_iban": "",
"swift": ""
},
"address": {
"country_code": "HU",
"post_code": "1011",
"city": "Budapest",
"address": "Fő utca 1."
},
"small_taxpayer": false,
"ev_number": "",
"eu_tax_number": "",
"cash_settled": false
},
"partner": {
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "12345678-2-42",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"general_ledger_number": "",
"tax_type": "HAS_TAX_NUMBER",
"custom_billing_settings": {
"payment_method": null,
"document_form": null,
"due_days": null,
"document_currency": null,
"template_language_code": null,
"discount": null,
"custom_label": null
},
"group_member_tax_number": "",
"giro_settings": {
"giro_default_settings": true,
"giro_payment_request_enabled": false,
"giro_different_amount_allowed": false
},
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
},
"internal_comment": "",
"partner_show_type": null
},
"document_partner": {
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "12345678-2-42",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"tax_type": "HAS_TAX_NUMBER",
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
}
},
"electronic": false,
"comment": "",
"tags": [],
"notification_status": "none",
"language": "hu",
"items": [
{
"product_id": null,
"name": "Termék vagy szolgáltatás",
"net_unit_amount": 20000.000001,
"quantity": 1,
"unit": "db",
"net_amount": 20000,
"gross_amount": 25400,
"vat": "27%",
"vat_amount": 5400,
"entitlement": null,
"comment": "",
"sku": null,
"data_eraser_codes": null,
"is_deposit_fee": false,
"ean": null,
"is_connect_product": false,
"connected_item": null,
"connect_document_item_setting": null
}
],
"summary": {
"net_amount": 20000,
"net_amount_local": 20000,
"gross_amount_local": 25400,
"vat_amount": 5400,
"vat_amount_local": 5400,
"vat_rate_summary": [
{
"vat_name": "27%",
"vat_percentage": 0.27,
"vat_rate_net_amount": 20000,
"vat_rate_vat_amount": 5400,
"vat_rate_vat_amount_local": 5400,
"vat_rate_gross_amount": 25400
}
]
},
"settings": {
"mediated_service": false,
"without_financial_fulfillment": false,
"online_payment": "no",
"should_send_email": false,
"round": "none",
"no_send_onlineszamla_by_user": false,
"dont_send_to_nav_reason": null,
"order_number": "",
"place_id": null,
"instant_payment": true,
"selected_type": null,
"instant_payment_request": null,
"is_waybill_hide_prices": false
},
"online_szamla_status": "processing",
"kobak_receipt_status": null,
"kobak_receipt_message": null,
"related_documents": [],
"discount": null,
"correction_type": "invoice",
"recurring_id": null
}
]
}HTTP/1.1 201
content-type: application/json
{
"id": 2,
"invoice_number": "2026-2",
"type": "modification",
"cancelled": false,
"block_id": 1,
"payment_status": "outstanding",
"payment_method": "stripe",
"gross_total": -5000,
"currency": "HUF",
"conversion_rate": 1,
"invoice_date": "2026-11-16",
"fulfillment_date": "2026-11-16",
"due_date": "2026-11-24",
"paid_date": "2026-11-16",
"organization": {
"name": "Hamis Billingo teszt szervezet",
"tax_number": "00000000-0-00",
"bank_account": {
"id": null,
"name": "",
"account_number": "",
"account_number_iban": "",
"swift": ""
},
"address": {
"country_code": "HU",
"post_code": "1011",
"city": "Budapest",
"address": "Fő utca 1."
},
"small_taxpayer": false,
"ev_number": "",
"eu_tax_number": "",
"cash_settled": false
},
"partner": {
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "12345678-2-42",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"general_ledger_number": "",
"tax_type": "HAS_TAX_NUMBER",
"custom_billing_settings": {
"payment_method": null,
"document_form": null,
"due_days": null,
"document_currency": null,
"template_language_code": null,
"discount": null,
"custom_label": null
},
"group_member_tax_number": "",
"giro_settings": {
"giro_default_settings": true,
"giro_payment_request_enabled": false,
"giro_different_amount_allowed": false
},
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
},
"internal_comment": "",
"partner_show_type": null
},
"document_partner": {
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "12345678-2-42",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"tax_type": "HAS_TAX_NUMBER",
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
}
},
"electronic": false,
"comment": "(Visszatérítés STRIPE-pi_3QhB7d re_1)",
"tags": [],
"notification_status": "none",
"language": "hu",
"items": [
{
"product_id": null,
"name": "Termék vagy szolgáltatás",
"net_unit_amount": -3937.007875,
"quantity": 1,
"unit": "db",
"net_amount": -3937.01,
"gross_amount": -5000,
"vat": "27%",
"vat_amount": -1062.99,
"entitlement": null,
"comment": "",
"sku": null,
"data_eraser_codes": null,
"is_deposit_fee": false,
"ean": null,
"is_connect_product": false,
"connected_item": null,
"connect_document_item_setting": null
}
],
"summary": {
"net_amount": -3937.01,
"net_amount_local": -3937.01,
"gross_amount_local": -5000,
"vat_amount": -1062.99,
"vat_amount_local": -1063,
"vat_rate_summary": [
{
"vat_name": "27%",
"vat_percentage": 0.27,
"vat_rate_net_amount": -3937.01,
"vat_rate_vat_amount": -1062.99,
"vat_rate_vat_amount_local": -1063,
"vat_rate_gross_amount": -5000
}
]
},
"settings": {
"mediated_service": false,
"without_financial_fulfillment": false,
"online_payment": "no",
"should_send_email": false,
"round": "none",
"no_send_onlineszamla_by_user": false,
"dont_send_to_nav_reason": null,
"order_number": "",
"place_id": null,
"instant_payment": true,
"selected_type": null,
"instant_payment_request": null,
"is_waybill_hide_prices": false
},
"online_szamla_status": "processing",
"kobak_receipt_status": null,
"kobak_receipt_message": null,
"related_documents": [
{
"id": 1,
"invoice_number": "2026-1"
}
],
"discount": null,
"correction_type": "modification",
"recurring_id": null
}HTTP/1.1 200
content-type: application/json
{
"id": 1,
"invoice_number": "2026-1",
"type": "invoice",
"cancelled": false,
"block_id": 1,
"payment_status": "paid",
"payment_method": "stripe",
"gross_total": 25400,
"currency": "HUF",
"conversion_rate": 1,
"invoice_date": "2026-11-16",
"fulfillment_date": "2026-11-16",
"due_date": "2026-11-24",
"paid_date": "2026-11-16",
"organization": {
"name": "Hamis Billingo teszt szervezet",
"tax_number": "00000000-0-00",
"bank_account": {
"id": null,
"name": "",
"account_number": "",
"account_number_iban": "",
"swift": ""
},
"address": {
"country_code": "HU",
"post_code": "1011",
"city": "Budapest",
"address": "Fő utca 1."
},
"small_taxpayer": false,
"ev_number": "",
"eu_tax_number": "",
"cash_settled": false
},
"partner": {
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "12345678-2-42",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"general_ledger_number": "",
"tax_type": "HAS_TAX_NUMBER",
"custom_billing_settings": {
"payment_method": null,
"document_form": null,
"due_days": null,
"document_currency": null,
"template_language_code": null,
"discount": null,
"custom_label": null
},
"group_member_tax_number": "",
"giro_settings": {
"giro_default_settings": true,
"giro_payment_request_enabled": false,
"giro_different_amount_allowed": false
},
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
},
"internal_comment": "",
"partner_show_type": null
},
"document_partner": {
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "12345678-2-42",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"tax_type": "HAS_TAX_NUMBER",
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
}
},
"electronic": false,
"comment": "",
"tags": [],
"notification_status": "none",
"language": "hu",
"items": [
{
"product_id": null,
"name": "Termék vagy szolgáltatás",
"net_unit_amount": 20000.000001,
"quantity": 1,
"unit": "db",
"net_amount": 20000,
"gross_amount": 25400,
"vat": "27%",
"vat_amount": 5400,
"entitlement": null,
"comment": "",
"sku": null,
"data_eraser_codes": null,
"is_deposit_fee": false,
"ean": null,
"is_connect_product": false,
"connected_item": null,
"connect_document_item_setting": null
}
],
"summary": {
"net_amount": 20000,
"net_amount_local": 20000,
"gross_amount_local": 25400,
"vat_amount": 5400,
"vat_amount_local": 5400,
"vat_rate_summary": [
{
"vat_name": "27%",
"vat_percentage": 0.27,
"vat_rate_net_amount": 20000,
"vat_rate_vat_amount": 5400,
"vat_rate_vat_amount_local": 5400,
"vat_rate_gross_amount": 25400
}
]
},
"settings": {
"mediated_service": false,
"without_financial_fulfillment": false,
"online_payment": "no",
"should_send_email": false,
"round": "none",
"no_send_onlineszamla_by_user": false,
"dont_send_to_nav_reason": null,
"order_number": "",
"place_id": null,
"instant_payment": true,
"selected_type": null,
"instant_payment_request": null,
"is_waybill_hide_prices": false
},
"online_szamla_status": "processing",
"kobak_receipt_status": null,
"kobak_receipt_message": null,
"related_documents": [],
"discount": null,
"correction_type": "modified",
"recurring_id": null
}számla: 2026-1
módosító számla: 2 true
újraküldött esemény: 2 false
bruttó: -5000Az Elküldött kérések fülön az első visszatérítés négy kérés: a számla keresése vendorId-val, a számla lekérése, a módosítók keresése a listában, végül a POST /documents/1/create-modification-document. Az újraküldött eseménynél csak a vendorId keresés megy ki, a ledger már tudja a módosító azonosítóját.
Az eredmény#
{ kind: 'modification', vendorId, originalId, created, modifications: [{ refundId, modificationId, created, amount, grossTotal }] }A módosító áfakulcsonként egy sort tartalmaz, 1-es mennyiséggel és negatív bruttó egységárral. Ha az áfakulcshoz egyetlen tétel tartozik, a sor a tétel nevét kapja, különben Visszatérítés (27%) lesz a neve. A megjegyzése a (Visszatérítés <vendorId> <refundId>) jelölő. Ha a refundId 40 karakternél hosszabb, vagy az angol betűkön, számokon és a _.:- jeleken kívül mást is tartalmaz, a helyére a kivonata kerül (h és 16 hexa jegy). A példa számlájának egy tétele van (Termék vagy szolgáltatás, mert a fizetés nem hozott tételeket), a Billingónak ezt küldi:
{
"comment": "(Visszatérítés STRIPE-pi_3QhB7d re_1)",
"payment_method": "stripe",
"items": [
{
"name": "Termék vagy szolgáltatás",
"quantity": 1,
"unit": "db",
"vat": "27%",
"unit_price": -5000,
"unit_price_type": "gross"
}
]
}Mikor csak javaslat?#
A tárca a következő esetekben nem állít ki bizonylatot, hanem refund-proposal eredményt ad egy javasolt tételbontással (refunds: [{ refundId, amount, items }]) és az okkal (reason):
| Helyzet | Miért? |
|---|---|
Nincs ledger | Tartós tároló nélkül egy újraküldés második módosítót állítana ki. |
| A bizonylat nyugta | A Billingo nyugtához nem ad módosító bizonylatot, nyugtát csak sztornózni lehet. |
A számlán több áfakulcs van, és nincs refundItems vagy partialRefund: 'proportional' | Hogy a visszatérítés melyik tételre szól, azt csak te tudod. |
A javaslatot naplózd, és jelezd a könyvelődnek. Ha a fizetésnek még nincs bizonylata, in_progress jön, mint a teljes visszatérítésnél. refunds nélküli eseményre az eredmény skipped.
Melyik tételből mennyi?#
partialRefund | Viselkedés |
|---|---|
'auto' (alapértelmezett) | Egy áfakulcsnál a teljes összeg arra a kulcsra; több kulcsnál javaslat, hacsak nincs refundItems. |
'proportional' | A számla tételei arányában osztja szét, az allocateRefund() szabályával. |
'skip' | Nem ír, skipped eredményt ad. |
A refundItems(context) saját tételeket ad egy visszatérítéshez: context.refund a visszatérítés, context.document a számla, context.items a számla tételei váltóegységben. Pozitív bruttó egységárral add vissza a visszatérített tételeket, a tárca fordítja negatívba. undefined esetén a partialRefund szabálya érvényes.
import { } from 'tarcajs/payments'
.(
(
[
{ : 'Póló', : '27%', : 1_270_000 },
{ : 'Könyv', : '5%', : 630_000 },
],
500_000,
),
)Az allocateRefund(items, refundMinor, { refundedBeforeMinor }) egész váltóegységben, pontosan osztja szét a visszatérítést. A fenti 5 000 Ft-ból 3 342,11 Ft jut a pólóra és 1 657,89 Ft a könyvre. A felosztás útfüggetlen: két egymás utáni részleges visszatérítés összesen ugyanazt adja, mint egy nagy, és egy tételre sem jut több, mint az eredeti összege. Ha a visszatérítések összege meghaladná a bizonylatét, validation hiba.
A createModificationOnce()#
Az issueForPayment() a createModificationOnce() függvénnyel állítja ki a módosítót. Saját folyamatban közvetlenül is hívhatod:
import { , type KeyValueStore } from 'tarcajs'
import { } from 'tarcajs/payments'
declare const : KeyValueStore
const = ()
const = await (, {
: 1,
: 'ORDER-1001',
: 'visszaru-1',
,
: [{ : 'Visszáru', : 1, : -5_000, : 27 }],
})- A ledger kulcsa
refundLedgerKey(vendorId, documentId, refundId)=tarca:refund:<sha256>, értéke{ state: 'pending' | 'done', modificationId, grossTotal }, 30 napig él. - Ha a bejegyzés
done, azonnal visszaadja (created: false). - Különben lefoglalja a kulcsot, és a
documents.list({ partnerId, startDate })találatai között (legfeljebb 5 oldal) keres egy módosítót, amely az eredetire hivatkozik, és a megjegyzésében ott a jelölő. Így egy lejárt vagy elveszett ledger bejegyzés sem vezet második módosítóhoz. - Csak ezután küldi a POST-ot a jelölővel, majd
done-ra állítja a bejegyzést.
Végleges Billingo hiba (4xx) vagy helyi validation után felszabadítja a foglalást. Bizonytalan hiba (hálózat, időtúllépés, 5xx, unexpected_response) után megtartja, és a listából próbálja megtalálni. Ha nem találja, in_progress hibát ad, a webhook 500-zal válaszol, és az újraküldés rendezi. A ledger olvasási hibája store_unavailable, kérés előtt. A ledger setIfAbsent nélkül configuration hiba.
Melyik tároló alkalmas ledgernek: Tárolók. A módosító számla Billingo oldali részletei: Módosító számla.