@scell/sdk 1.7.0 → 1.8.0
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.
- package/README.md +61 -0
- package/dist/index.d.mts +29 -5
- package/dist/index.d.ts +29 -5
- package/package.json +1 -1
- package/src/types/common.ts +1 -1
- package/src/types/companies.ts +5 -1
- package/src/types/invoices.ts +23 -3
package/README.md
CHANGED
|
@@ -87,6 +87,67 @@ const { data: invoice } = await apiClient.invoices.create({
|
|
|
87
87
|
console.log('Invoice created:', invoice.id);
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
### International Invoicing
|
|
91
|
+
|
|
92
|
+
For non-French parties, SIRET is not required. Use VAT numbers for EU businesses and `legal_id` with a scheme code for non-EU businesses.
|
|
93
|
+
|
|
94
|
+
#### Invoice with Belgian Buyer (EU)
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
const { data: invoice } = await apiClient.invoices.create({
|
|
98
|
+
invoice_number: 'INV-2026-042',
|
|
99
|
+
issue_date: '2026-03-29',
|
|
100
|
+
due_date: '2026-04-28',
|
|
101
|
+
currency: 'EUR',
|
|
102
|
+
// French seller (SIRET required)
|
|
103
|
+
seller_siret: '12345678901234',
|
|
104
|
+
seller_name: 'Ma Société SAS',
|
|
105
|
+
seller_country: 'FR',
|
|
106
|
+
seller_vat_number: 'FR12345678901',
|
|
107
|
+
seller_address: { line1: '10 rue de Paris', postal_code: '75001', city: 'Paris', country: 'FR' },
|
|
108
|
+
// Belgian buyer (no SIRET, VAT number instead)
|
|
109
|
+
buyer_name: 'Entreprise Belge SPRL',
|
|
110
|
+
buyer_country: 'BE',
|
|
111
|
+
buyer_vat_number: 'BE0123456789',
|
|
112
|
+
buyer_address: { line1: '15 Avenue Louise', postal_code: '1050', city: 'Bruxelles', country: 'BE' },
|
|
113
|
+
lines: [
|
|
114
|
+
{ description: 'Consulting services', quantity: 10, unit_price: 150.00, vat_rate: 0 },
|
|
115
|
+
],
|
|
116
|
+
format: 'ubl',
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
> **Note:** For intra-community B2B transactions (e.g. FR -> BE, FR -> DE), VAT rate is typically 0% under the reverse charge mechanism. The buyer accounts for VAT in their own country.
|
|
121
|
+
|
|
122
|
+
#### Invoice with UK Buyer (Non-EU)
|
|
123
|
+
|
|
124
|
+
For non-EU buyers, use `buyer_legal_id` and `buyer_legal_id_scheme` in addition to the VAT number:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
const { data: invoice } = await apiClient.invoices.create({
|
|
128
|
+
invoice_number: 'INV-2026-044',
|
|
129
|
+
issue_date: '2026-03-29',
|
|
130
|
+
due_date: '2026-04-28',
|
|
131
|
+
currency: 'GBP',
|
|
132
|
+
seller_siret: '12345678901234',
|
|
133
|
+
seller_name: 'Ma Société SAS',
|
|
134
|
+
seller_country: 'FR',
|
|
135
|
+
seller_vat_number: 'FR12345678901',
|
|
136
|
+
seller_address: { line1: '10 rue de Paris', postal_code: '75001', city: 'Paris', country: 'FR' },
|
|
137
|
+
// UK buyer — legal_id with scheme
|
|
138
|
+
buyer_name: 'British Ltd',
|
|
139
|
+
buyer_country: 'GB',
|
|
140
|
+
buyer_vat_number: 'GB123456789',
|
|
141
|
+
buyer_legal_id: '12345678',
|
|
142
|
+
buyer_legal_id_scheme: '0088', // UK Company Number scheme
|
|
143
|
+
buyer_address: { line1: '20 Baker Street', postal_code: 'W1U 3BW', city: 'London', country: 'GB' },
|
|
144
|
+
lines: [
|
|
145
|
+
{ description: 'Design services', quantity: 5, unit_price: 200.00, vat_rate: 0 },
|
|
146
|
+
],
|
|
147
|
+
format: 'ubl',
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
90
151
|
### Create a Signature Request
|
|
91
152
|
|
|
92
153
|
```typescript
|
package/dist/index.d.mts
CHANGED
|
@@ -183,7 +183,7 @@ interface Address {
|
|
|
183
183
|
line2?: string | undefined;
|
|
184
184
|
postal_code: string;
|
|
185
185
|
city: string;
|
|
186
|
-
country
|
|
186
|
+
country: string;
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* Pagination metadata
|
|
@@ -276,7 +276,11 @@ interface InvoiceLine {
|
|
|
276
276
|
* Invoice party (seller or buyer)
|
|
277
277
|
*/
|
|
278
278
|
interface InvoiceParty {
|
|
279
|
-
siret
|
|
279
|
+
siret?: Siret;
|
|
280
|
+
vat_number?: string;
|
|
281
|
+
legal_id?: string;
|
|
282
|
+
legal_id_scheme?: string;
|
|
283
|
+
country: string;
|
|
280
284
|
name: string;
|
|
281
285
|
address: Address;
|
|
282
286
|
}
|
|
@@ -351,13 +355,29 @@ interface CreateInvoiceInput {
|
|
|
351
355
|
/** Total including tax */
|
|
352
356
|
total_ttc: number;
|
|
353
357
|
/** Seller SIRET (14 digits) */
|
|
354
|
-
seller_siret
|
|
358
|
+
seller_siret?: Siret;
|
|
359
|
+
/** Seller VAT number */
|
|
360
|
+
seller_vat_number?: string;
|
|
361
|
+
/** Seller country (ISO 3166-1 alpha-2) */
|
|
362
|
+
seller_country: string;
|
|
363
|
+
/** Seller legal identifier */
|
|
364
|
+
seller_legal_id?: string;
|
|
365
|
+
/** Seller legal identifier scheme */
|
|
366
|
+
seller_legal_id_scheme?: string;
|
|
355
367
|
/** Seller company name */
|
|
356
368
|
seller_name: string;
|
|
357
369
|
/** Seller address */
|
|
358
370
|
seller_address: Address;
|
|
359
371
|
/** Buyer SIRET (14 digits) */
|
|
360
|
-
buyer_siret
|
|
372
|
+
buyer_siret?: Siret;
|
|
373
|
+
/** Buyer VAT number */
|
|
374
|
+
buyer_vat_number?: string;
|
|
375
|
+
/** Buyer country (ISO 3166-1 alpha-2) */
|
|
376
|
+
buyer_country: string;
|
|
377
|
+
/** Buyer legal identifier */
|
|
378
|
+
buyer_legal_id?: string;
|
|
379
|
+
/** Buyer legal identifier scheme */
|
|
380
|
+
buyer_legal_id_scheme?: string;
|
|
361
381
|
/** Buyer company name */
|
|
362
382
|
buyer_name: string;
|
|
363
383
|
/** Buyer address */
|
|
@@ -3091,6 +3111,8 @@ interface Company {
|
|
|
3091
3111
|
siret: Siret;
|
|
3092
3112
|
siren: Siren | null;
|
|
3093
3113
|
vat_number: string | null;
|
|
3114
|
+
legal_id: string | null;
|
|
3115
|
+
legal_id_scheme: string | null;
|
|
3094
3116
|
legal_form: string | null;
|
|
3095
3117
|
address_line1: string;
|
|
3096
3118
|
address_line2: string | null;
|
|
@@ -3111,7 +3133,9 @@ interface Company {
|
|
|
3111
3133
|
*/
|
|
3112
3134
|
interface CreateCompanyInput {
|
|
3113
3135
|
name: string;
|
|
3114
|
-
siret
|
|
3136
|
+
siret?: Siret;
|
|
3137
|
+
legal_id?: string;
|
|
3138
|
+
legal_id_scheme?: string;
|
|
3115
3139
|
vat_number?: string | undefined;
|
|
3116
3140
|
legal_form?: string | undefined;
|
|
3117
3141
|
address_line1: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -183,7 +183,7 @@ interface Address {
|
|
|
183
183
|
line2?: string | undefined;
|
|
184
184
|
postal_code: string;
|
|
185
185
|
city: string;
|
|
186
|
-
country
|
|
186
|
+
country: string;
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* Pagination metadata
|
|
@@ -276,7 +276,11 @@ interface InvoiceLine {
|
|
|
276
276
|
* Invoice party (seller or buyer)
|
|
277
277
|
*/
|
|
278
278
|
interface InvoiceParty {
|
|
279
|
-
siret
|
|
279
|
+
siret?: Siret;
|
|
280
|
+
vat_number?: string;
|
|
281
|
+
legal_id?: string;
|
|
282
|
+
legal_id_scheme?: string;
|
|
283
|
+
country: string;
|
|
280
284
|
name: string;
|
|
281
285
|
address: Address;
|
|
282
286
|
}
|
|
@@ -351,13 +355,29 @@ interface CreateInvoiceInput {
|
|
|
351
355
|
/** Total including tax */
|
|
352
356
|
total_ttc: number;
|
|
353
357
|
/** Seller SIRET (14 digits) */
|
|
354
|
-
seller_siret
|
|
358
|
+
seller_siret?: Siret;
|
|
359
|
+
/** Seller VAT number */
|
|
360
|
+
seller_vat_number?: string;
|
|
361
|
+
/** Seller country (ISO 3166-1 alpha-2) */
|
|
362
|
+
seller_country: string;
|
|
363
|
+
/** Seller legal identifier */
|
|
364
|
+
seller_legal_id?: string;
|
|
365
|
+
/** Seller legal identifier scheme */
|
|
366
|
+
seller_legal_id_scheme?: string;
|
|
355
367
|
/** Seller company name */
|
|
356
368
|
seller_name: string;
|
|
357
369
|
/** Seller address */
|
|
358
370
|
seller_address: Address;
|
|
359
371
|
/** Buyer SIRET (14 digits) */
|
|
360
|
-
buyer_siret
|
|
372
|
+
buyer_siret?: Siret;
|
|
373
|
+
/** Buyer VAT number */
|
|
374
|
+
buyer_vat_number?: string;
|
|
375
|
+
/** Buyer country (ISO 3166-1 alpha-2) */
|
|
376
|
+
buyer_country: string;
|
|
377
|
+
/** Buyer legal identifier */
|
|
378
|
+
buyer_legal_id?: string;
|
|
379
|
+
/** Buyer legal identifier scheme */
|
|
380
|
+
buyer_legal_id_scheme?: string;
|
|
361
381
|
/** Buyer company name */
|
|
362
382
|
buyer_name: string;
|
|
363
383
|
/** Buyer address */
|
|
@@ -3091,6 +3111,8 @@ interface Company {
|
|
|
3091
3111
|
siret: Siret;
|
|
3092
3112
|
siren: Siren | null;
|
|
3093
3113
|
vat_number: string | null;
|
|
3114
|
+
legal_id: string | null;
|
|
3115
|
+
legal_id_scheme: string | null;
|
|
3094
3116
|
legal_form: string | null;
|
|
3095
3117
|
address_line1: string;
|
|
3096
3118
|
address_line2: string | null;
|
|
@@ -3111,7 +3133,9 @@ interface Company {
|
|
|
3111
3133
|
*/
|
|
3112
3134
|
interface CreateCompanyInput {
|
|
3113
3135
|
name: string;
|
|
3114
|
-
siret
|
|
3136
|
+
siret?: Siret;
|
|
3137
|
+
legal_id?: string;
|
|
3138
|
+
legal_id_scheme?: string;
|
|
3115
3139
|
vat_number?: string | undefined;
|
|
3116
3140
|
legal_form?: string | undefined;
|
|
3117
3141
|
address_line1: string;
|
package/package.json
CHANGED
package/src/types/common.ts
CHANGED
package/src/types/companies.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface Company {
|
|
|
14
14
|
siret: Siret;
|
|
15
15
|
siren: Siren | null;
|
|
16
16
|
vat_number: string | null;
|
|
17
|
+
legal_id: string | null;
|
|
18
|
+
legal_id_scheme: string | null;
|
|
17
19
|
legal_form: string | null;
|
|
18
20
|
address_line1: string;
|
|
19
21
|
address_line2: string | null;
|
|
@@ -35,7 +37,9 @@ export interface Company {
|
|
|
35
37
|
*/
|
|
36
38
|
export interface CreateCompanyInput {
|
|
37
39
|
name: string;
|
|
38
|
-
siret
|
|
40
|
+
siret?: Siret;
|
|
41
|
+
legal_id?: string;
|
|
42
|
+
legal_id_scheme?: string;
|
|
39
43
|
vat_number?: string | undefined;
|
|
40
44
|
legal_form?: string | undefined;
|
|
41
45
|
address_line1: string;
|
package/src/types/invoices.ts
CHANGED
|
@@ -57,7 +57,11 @@ export interface InvoiceLine {
|
|
|
57
57
|
* Invoice party (seller or buyer)
|
|
58
58
|
*/
|
|
59
59
|
export interface InvoiceParty {
|
|
60
|
-
siret
|
|
60
|
+
siret?: Siret;
|
|
61
|
+
vat_number?: string;
|
|
62
|
+
legal_id?: string;
|
|
63
|
+
legal_id_scheme?: string;
|
|
64
|
+
country: string;
|
|
61
65
|
name: string;
|
|
62
66
|
address: Address;
|
|
63
67
|
}
|
|
@@ -135,13 +139,29 @@ export interface CreateInvoiceInput {
|
|
|
135
139
|
/** Total including tax */
|
|
136
140
|
total_ttc: number;
|
|
137
141
|
/** Seller SIRET (14 digits) */
|
|
138
|
-
seller_siret
|
|
142
|
+
seller_siret?: Siret;
|
|
143
|
+
/** Seller VAT number */
|
|
144
|
+
seller_vat_number?: string;
|
|
145
|
+
/** Seller country (ISO 3166-1 alpha-2) */
|
|
146
|
+
seller_country: string;
|
|
147
|
+
/** Seller legal identifier */
|
|
148
|
+
seller_legal_id?: string;
|
|
149
|
+
/** Seller legal identifier scheme */
|
|
150
|
+
seller_legal_id_scheme?: string;
|
|
139
151
|
/** Seller company name */
|
|
140
152
|
seller_name: string;
|
|
141
153
|
/** Seller address */
|
|
142
154
|
seller_address: Address;
|
|
143
155
|
/** Buyer SIRET (14 digits) */
|
|
144
|
-
buyer_siret
|
|
156
|
+
buyer_siret?: Siret;
|
|
157
|
+
/** Buyer VAT number */
|
|
158
|
+
buyer_vat_number?: string;
|
|
159
|
+
/** Buyer country (ISO 3166-1 alpha-2) */
|
|
160
|
+
buyer_country: string;
|
|
161
|
+
/** Buyer legal identifier */
|
|
162
|
+
buyer_legal_id?: string;
|
|
163
|
+
/** Buyer legal identifier scheme */
|
|
164
|
+
buyer_legal_id_scheme?: string;
|
|
145
165
|
/** Buyer company name */
|
|
146
166
|
buyer_name: string;
|
|
147
167
|
/** Buyer address */
|