@scell/sdk 1.7.0 → 1.9.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 -1
- package/dist/index.d.mts +29 -7
- package/dist/index.d.ts +29 -7
- 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 -5
package/README.md
CHANGED
|
@@ -44,9 +44,10 @@ const apiClient = new ScellApiClient('your-api-key');
|
|
|
44
44
|
|
|
45
45
|
### Create an Invoice
|
|
46
46
|
|
|
47
|
+
> **Note:** Invoice numbers are automatically generated by Scell.io. Draft invoices receive a temporary number, and the definitive fiscal number is assigned when the invoice is submitted.
|
|
48
|
+
|
|
47
49
|
```typescript
|
|
48
50
|
const { data: invoice } = await apiClient.invoices.create({
|
|
49
|
-
invoice_number: 'FACT-2024-001',
|
|
50
51
|
direction: 'outgoing',
|
|
51
52
|
output_format: 'facturx',
|
|
52
53
|
issue_date: '2024-01-15',
|
|
@@ -87,6 +88,65 @@ const { data: invoice } = await apiClient.invoices.create({
|
|
|
87
88
|
console.log('Invoice created:', invoice.id);
|
|
88
89
|
```
|
|
89
90
|
|
|
91
|
+
### International Invoicing
|
|
92
|
+
|
|
93
|
+
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.
|
|
94
|
+
|
|
95
|
+
#### Invoice with Belgian Buyer (EU)
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
const { data: invoice } = await apiClient.invoices.create({
|
|
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
|
+
issue_date: '2026-03-29',
|
|
129
|
+
due_date: '2026-04-28',
|
|
130
|
+
currency: 'GBP',
|
|
131
|
+
seller_siret: '12345678901234',
|
|
132
|
+
seller_name: 'Ma Société SAS',
|
|
133
|
+
seller_country: 'FR',
|
|
134
|
+
seller_vat_number: 'FR12345678901',
|
|
135
|
+
seller_address: { line1: '10 rue de Paris', postal_code: '75001', city: 'Paris', country: 'FR' },
|
|
136
|
+
// UK buyer — legal_id with scheme
|
|
137
|
+
buyer_name: 'British Ltd',
|
|
138
|
+
buyer_country: 'GB',
|
|
139
|
+
buyer_vat_number: 'GB123456789',
|
|
140
|
+
buyer_legal_id: '12345678',
|
|
141
|
+
buyer_legal_id_scheme: '0088', // UK Company Number scheme
|
|
142
|
+
buyer_address: { line1: '20 Baker Street', postal_code: 'W1U 3BW', city: 'London', country: 'GB' },
|
|
143
|
+
lines: [
|
|
144
|
+
{ description: 'Design services', quantity: 5, unit_price: 200.00, vat_rate: 0 },
|
|
145
|
+
],
|
|
146
|
+
format: 'ubl',
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
90
150
|
### Create a Signature Request
|
|
91
151
|
|
|
92
152
|
```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
|
}
|
|
@@ -332,8 +336,6 @@ interface InvoiceLineInput {
|
|
|
332
336
|
interface CreateInvoiceInput {
|
|
333
337
|
/** Your external reference ID */
|
|
334
338
|
external_id?: string | undefined;
|
|
335
|
-
/** Invoice number (required) */
|
|
336
|
-
invoice_number: string;
|
|
337
339
|
/** Direction: outgoing (sale) or incoming (purchase) */
|
|
338
340
|
direction: InvoiceDirection;
|
|
339
341
|
/** Output format for electronic invoice */
|
|
@@ -351,13 +353,29 @@ interface CreateInvoiceInput {
|
|
|
351
353
|
/** Total including tax */
|
|
352
354
|
total_ttc: number;
|
|
353
355
|
/** Seller SIRET (14 digits) */
|
|
354
|
-
seller_siret
|
|
356
|
+
seller_siret?: Siret;
|
|
357
|
+
/** Seller VAT number */
|
|
358
|
+
seller_vat_number?: string;
|
|
359
|
+
/** Seller country (ISO 3166-1 alpha-2) */
|
|
360
|
+
seller_country: string;
|
|
361
|
+
/** Seller legal identifier */
|
|
362
|
+
seller_legal_id?: string;
|
|
363
|
+
/** Seller legal identifier scheme */
|
|
364
|
+
seller_legal_id_scheme?: string;
|
|
355
365
|
/** Seller company name */
|
|
356
366
|
seller_name: string;
|
|
357
367
|
/** Seller address */
|
|
358
368
|
seller_address: Address;
|
|
359
369
|
/** Buyer SIRET (14 digits) */
|
|
360
|
-
buyer_siret
|
|
370
|
+
buyer_siret?: Siret;
|
|
371
|
+
/** Buyer VAT number */
|
|
372
|
+
buyer_vat_number?: string;
|
|
373
|
+
/** Buyer country (ISO 3166-1 alpha-2) */
|
|
374
|
+
buyer_country: string;
|
|
375
|
+
/** Buyer legal identifier */
|
|
376
|
+
buyer_legal_id?: string;
|
|
377
|
+
/** Buyer legal identifier scheme */
|
|
378
|
+
buyer_legal_id_scheme?: string;
|
|
361
379
|
/** Buyer company name */
|
|
362
380
|
buyer_name: string;
|
|
363
381
|
/** Buyer address */
|
|
@@ -3091,6 +3109,8 @@ interface Company {
|
|
|
3091
3109
|
siret: Siret;
|
|
3092
3110
|
siren: Siren | null;
|
|
3093
3111
|
vat_number: string | null;
|
|
3112
|
+
legal_id: string | null;
|
|
3113
|
+
legal_id_scheme: string | null;
|
|
3094
3114
|
legal_form: string | null;
|
|
3095
3115
|
address_line1: string;
|
|
3096
3116
|
address_line2: string | null;
|
|
@@ -3111,7 +3131,9 @@ interface Company {
|
|
|
3111
3131
|
*/
|
|
3112
3132
|
interface CreateCompanyInput {
|
|
3113
3133
|
name: string;
|
|
3114
|
-
siret
|
|
3134
|
+
siret?: Siret;
|
|
3135
|
+
legal_id?: string;
|
|
3136
|
+
legal_id_scheme?: string;
|
|
3115
3137
|
vat_number?: string | undefined;
|
|
3116
3138
|
legal_form?: string | undefined;
|
|
3117
3139
|
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
|
}
|
|
@@ -332,8 +336,6 @@ interface InvoiceLineInput {
|
|
|
332
336
|
interface CreateInvoiceInput {
|
|
333
337
|
/** Your external reference ID */
|
|
334
338
|
external_id?: string | undefined;
|
|
335
|
-
/** Invoice number (required) */
|
|
336
|
-
invoice_number: string;
|
|
337
339
|
/** Direction: outgoing (sale) or incoming (purchase) */
|
|
338
340
|
direction: InvoiceDirection;
|
|
339
341
|
/** Output format for electronic invoice */
|
|
@@ -351,13 +353,29 @@ interface CreateInvoiceInput {
|
|
|
351
353
|
/** Total including tax */
|
|
352
354
|
total_ttc: number;
|
|
353
355
|
/** Seller SIRET (14 digits) */
|
|
354
|
-
seller_siret
|
|
356
|
+
seller_siret?: Siret;
|
|
357
|
+
/** Seller VAT number */
|
|
358
|
+
seller_vat_number?: string;
|
|
359
|
+
/** Seller country (ISO 3166-1 alpha-2) */
|
|
360
|
+
seller_country: string;
|
|
361
|
+
/** Seller legal identifier */
|
|
362
|
+
seller_legal_id?: string;
|
|
363
|
+
/** Seller legal identifier scheme */
|
|
364
|
+
seller_legal_id_scheme?: string;
|
|
355
365
|
/** Seller company name */
|
|
356
366
|
seller_name: string;
|
|
357
367
|
/** Seller address */
|
|
358
368
|
seller_address: Address;
|
|
359
369
|
/** Buyer SIRET (14 digits) */
|
|
360
|
-
buyer_siret
|
|
370
|
+
buyer_siret?: Siret;
|
|
371
|
+
/** Buyer VAT number */
|
|
372
|
+
buyer_vat_number?: string;
|
|
373
|
+
/** Buyer country (ISO 3166-1 alpha-2) */
|
|
374
|
+
buyer_country: string;
|
|
375
|
+
/** Buyer legal identifier */
|
|
376
|
+
buyer_legal_id?: string;
|
|
377
|
+
/** Buyer legal identifier scheme */
|
|
378
|
+
buyer_legal_id_scheme?: string;
|
|
361
379
|
/** Buyer company name */
|
|
362
380
|
buyer_name: string;
|
|
363
381
|
/** Buyer address */
|
|
@@ -3091,6 +3109,8 @@ interface Company {
|
|
|
3091
3109
|
siret: Siret;
|
|
3092
3110
|
siren: Siren | null;
|
|
3093
3111
|
vat_number: string | null;
|
|
3112
|
+
legal_id: string | null;
|
|
3113
|
+
legal_id_scheme: string | null;
|
|
3094
3114
|
legal_form: string | null;
|
|
3095
3115
|
address_line1: string;
|
|
3096
3116
|
address_line2: string | null;
|
|
@@ -3111,7 +3131,9 @@ interface Company {
|
|
|
3111
3131
|
*/
|
|
3112
3132
|
interface CreateCompanyInput {
|
|
3113
3133
|
name: string;
|
|
3114
|
-
siret
|
|
3134
|
+
siret?: Siret;
|
|
3135
|
+
legal_id?: string;
|
|
3136
|
+
legal_id_scheme?: string;
|
|
3115
3137
|
vat_number?: string | undefined;
|
|
3116
3138
|
legal_form?: string | undefined;
|
|
3117
3139
|
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
|
}
|
|
@@ -116,8 +120,6 @@ export interface InvoiceLineInput {
|
|
|
116
120
|
export interface CreateInvoiceInput {
|
|
117
121
|
/** Your external reference ID */
|
|
118
122
|
external_id?: string | undefined;
|
|
119
|
-
/** Invoice number (required) */
|
|
120
|
-
invoice_number: string;
|
|
121
123
|
/** Direction: outgoing (sale) or incoming (purchase) */
|
|
122
124
|
direction: InvoiceDirection;
|
|
123
125
|
/** Output format for electronic invoice */
|
|
@@ -135,13 +137,29 @@ export interface CreateInvoiceInput {
|
|
|
135
137
|
/** Total including tax */
|
|
136
138
|
total_ttc: number;
|
|
137
139
|
/** Seller SIRET (14 digits) */
|
|
138
|
-
seller_siret
|
|
140
|
+
seller_siret?: Siret;
|
|
141
|
+
/** Seller VAT number */
|
|
142
|
+
seller_vat_number?: string;
|
|
143
|
+
/** Seller country (ISO 3166-1 alpha-2) */
|
|
144
|
+
seller_country: string;
|
|
145
|
+
/** Seller legal identifier */
|
|
146
|
+
seller_legal_id?: string;
|
|
147
|
+
/** Seller legal identifier scheme */
|
|
148
|
+
seller_legal_id_scheme?: string;
|
|
139
149
|
/** Seller company name */
|
|
140
150
|
seller_name: string;
|
|
141
151
|
/** Seller address */
|
|
142
152
|
seller_address: Address;
|
|
143
153
|
/** Buyer SIRET (14 digits) */
|
|
144
|
-
buyer_siret
|
|
154
|
+
buyer_siret?: Siret;
|
|
155
|
+
/** Buyer VAT number */
|
|
156
|
+
buyer_vat_number?: string;
|
|
157
|
+
/** Buyer country (ISO 3166-1 alpha-2) */
|
|
158
|
+
buyer_country: string;
|
|
159
|
+
/** Buyer legal identifier */
|
|
160
|
+
buyer_legal_id?: string;
|
|
161
|
+
/** Buyer legal identifier scheme */
|
|
162
|
+
buyer_legal_id_scheme?: string;
|
|
145
163
|
/** Buyer company name */
|
|
146
164
|
buyer_name: string;
|
|
147
165
|
/** Buyer address */
|