eu_vat_rates_data 2026.8.13 → 2026.8.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +37 -0
- data/lib/eu_vat_rates_data/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 867e872a863f754240a5bc267436a0c980015a449506db8ee5617f3597334af3
|
|
4
|
+
data.tar.gz: 85a05ca031f7db5d96295f7017df4de7c1161ef97287d453a2242da0f044163a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e2042ba9b7dc8ab16fdf692c41bbaa11d332363dc43b24971d14f2bd0688c214661c5619a3b202e94717f1a221c0c0d18cee02c10abbd8c15c5c5e05a21bfc2
|
|
7
|
+
data.tar.gz: 03df437a6bde6839ce51c07bcb4c011b3191f8573f4587e4c814925be350f4c7eb931d219b3aaead9b75632e372557366b62eea3ef87328ce4c7dd733a728190
|
data/README.md
CHANGED
|
@@ -110,6 +110,43 @@ EuVatRatesData.flag("XX") # => "" (empty string for unknown/invalid codes)
|
|
|
110
110
|
|
|
111
111
|
---
|
|
112
112
|
|
|
113
|
+
## Example: charging VAT on an invoice
|
|
114
|
+
|
|
115
|
+
Rates on their own rarely answer the question you actually have, which is what
|
|
116
|
+
to put on the invoice. Two rules cover most of it: charge the buyer's domestic
|
|
117
|
+
rate, unless the sale is cross-border B2B inside the EU, where the reverse
|
|
118
|
+
charge applies and you invoice 0%.
|
|
119
|
+
|
|
120
|
+
```ruby
|
|
121
|
+
# Money in minor units (cents). Never floats.
|
|
122
|
+
def invoice_total(net_cents, seller_country, buyer_country, buyer_vat_id = nil)
|
|
123
|
+
cross_border_b2b = buyer_country != seller_country &&
|
|
124
|
+
!buyer_vat_id.nil? &&
|
|
125
|
+
EuVatRatesData.valid_format?(buyer_vat_id)
|
|
126
|
+
|
|
127
|
+
return { vat_cents: 0, total_cents: net_cents, reverse_charge: true } if cross_border_b2b
|
|
128
|
+
|
|
129
|
+
rate = EuVatRatesData.get_standard_rate(buyer_country)
|
|
130
|
+
vat_cents = (net_cents * rate / 100.0).round
|
|
131
|
+
|
|
132
|
+
{ vat_cents: vat_cents, total_cents: net_cents + vat_cents, reverse_charge: false }
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Domestic sale in Finland — 25.5%
|
|
136
|
+
invoice_total(10_000, 'FI', 'FI')
|
|
137
|
+
# => { vat_cents: 2550, total_cents: 12550, reverse_charge: false }
|
|
138
|
+
|
|
139
|
+
# Finnish seller, German business buyer — reverse charge
|
|
140
|
+
invoice_total(10_000, 'FI', 'DE', 'DE123456789')
|
|
141
|
+
# => { vat_cents: 0, total_cents: 10000, reverse_charge: true }
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`valid_format?` only checks the shape of the number. Applying the reverse charge
|
|
145
|
+
requires the buyer to actually be VAT-registered, which is a VIES lookup — see
|
|
146
|
+
above.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
113
150
|
## Data source & update frequency
|
|
114
151
|
|
|
115
152
|
How the daily check works, and what changed when: [vatnode.dev/data](https://vatnode.dev/data?ref=rates-readme-rb).
|