-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckout-api.yaml
More file actions
8203 lines (8171 loc) · 331 KB
/
checkout-api.yaml
File metadata and controls
8203 lines (8171 loc) · 331 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.1.0
info:
title: Two Order API
version: '1.0'
description: |-
This API is for creating orders connected to an online purchase through your solution.
The API also functions as a central building block when using other Two APIs, e.g. Marketplace API, and Trade Account Onboarding API.
Specifically, the API enables you to:
- Check whether a buyer is accepted for credit before placing the order (Order intent)
- Create orders
- Fulfil orders (Send invoice from Two)
- Edit orders
- Cancel orders
- Refund orders (Send credit note)
- Download invoice
Below you will find a description of a typical flow of how the different endpoints are called. However, you might want to deviate from this order depending on your setup.
For inspiration you can find a sample implementation of Two at https://demo.two.inc
### Step 0: Use the Two Company Search API to find the company
By using the Two Company Search API, you ensure that the user places an order on behalf of the correct organization. It enables an improved user experience and lowers the friction.
**Using Canonical IDs (Recommended):** The Company Search API returns a `canonical_id` for each company. You can use this canonical_id when creating orders and order intents instead of providing full company details. This ensures data accuracy and simplifies integration.
Example:
```json
{
"buyer": {
"company": {
"company_canonical_id": "abc123def456"
},
"representative": { ... }
}
}
```
### Step 1: Check whether a buyer will be accepted for credit during checkout (Order intent)
Use `POST /v1/order_intent` to credit check your buyers during the checkout. Only enable Two as the payment option if the credit check is approved.
Collect the `tracking_id` from the response of the order intent in order to connect the order_intent with the actual order being placed by the buyer.
### Step 2: Create order
Create an order by building a request body containing all required elements and call the `POST /v1/order` endpoint.
1. Read the state and status of the order response.
2. Check if the status is `APPROVED`.
3. Check if the state is `UNVERIFIED`, and redirect the user to the `payment_url`.
After completing the verfication, the user is redirected back to your order confirmation page.
### Step 3: Confirm order
On the order confirmation page use the `POST /v1/order/<order_id>/confirm` endpoint to confirm that the user has arrived at the order confirmation page.
### Step 4: Handling orders
#### Cancel order
Use `POST /v1/order/<order_id>/cancel` to cancel a specific order.
#### Edit order
Use `PUT /v1/order/<order_id>` with a specified request body to edit an order.
#### Fulfil order
Use `POST /v1/order/<order_id>/fulfilled` with a specified request body to fulfil all line items of an order.
Note: Include a request body in order to do a partial fulfillment.
#### Refund order
Use `POST /v1/order/<order_id>/refund` to refund a specific order.
Note: Include a request body in order to do a partial refund.
## Environments
### Testing
[https://api.sandbox.two.inc](https://api.sandbox.two.inc/v1/health)
Note: Read about our [sandbox environment specific behaviour](/docs/guides/sandbox-behaviour-page/).
### Production
[https://api.two.inc](https://api.two.inc/v1/health)
tags:
- name: Order intent
- name: Order
- name: Invoice
- name: API Key
- name: Settlement report
paths:
/v1/order_intent:
post:
summary: Create order intent
operationId: create_order_intent_handler.post
description: The endpoint enables the merchant to check in advance whether
invoice payment is applicable as a payment method for the `Buyer`.
Two will perform a risk assessment and credit check using the data
provided in the `OrderIntent` before a boolean is returned as a result.
If `line_items` are provided Two will be able to do a more accurate
assessment and the approval rate will in general increase.
tags:
- Order intent
parameters: []
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'201':
description: Create order intent
content:
application/json:
schema:
$ref: '#/components/schemas/OrderIntentResponseSchema'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateOrderIntentRequestSchema'
/v1/order_intent/{order_intent_id}:
get:
summary: Get order intent
operationId: get_order_intent_handler.get
description: The endpoint fetches a specific order intent.
tags:
- Order intent
parameters:
- name: order_intent_id
in: path
required: true
schema:
type: string
description: ''
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: Get order intent
content:
application/json:
schema:
$ref: '#/components/schemas/OrderIntentResponseSchema'
security:
- X-Api-Key: []
/v1/order:
post:
summary: Create order
operationId: create_order_handler.post
description: 'Endpoint to create a new order in Two''s system. Once all
the required order data has been added to the request body and the
order has been created successfully, Two performs a credit check of
the customer and updates the `status`. In addition to general information
about the order and its content, the response body contains the status
of the credit check and `payment_url` which is used for customer identification.
After the verification step is completed successfully, the order will
change `state`. The order is now approved and verified, i.e. the order
is placed. Later, the order has to be handled by the merchant, either
through Two''s API endpoints or the merchant portal. Note: When creating
an order it is important to note that the `invoice_type`, `country_prefix`,
and `organization_number` has to match what the merchant has signed
up for with Two. For trade account orders (providing `merchant_user_id`): -
The `buyer` object and `billing_address` can be omitted; they''ll
be populated from the trade account - If both are provided, the
`buyer` data will be persisted instead'
tags:
- Order
parameters: []
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'201':
description: Order created
content:
application/json:
schema:
$ref: '#/components/schemas/OrderResponseSchema'
security:
- X-Api-Key: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateOrderRequestSchema'
/v1/pricing/order/fee:
post:
summary: Quote fees for an order before creating or editing it.
operationId: calculate_pricing_order_fee_v1_handler.post
description: This endpoint returns the estimated fee for the provided
amount and order terms, and a `buyer_fee_share` value that can be
added as a buyer-facing line item when the merchant wants to recover
Two fees from the buyer.
tags:
- Order
parameters: []
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: Order fee quote response
content:
application/json:
schema:
$ref: '#/components/schemas/PricingOrderFeeResponseSchema'
'400':
description: Invalid request payload
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
security:
- X-Api-Key: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/OrderFeeRequestSchema'
/v1/order/{order_id}:
get:
summary: Get order details
operationId: get_order_handler.get
description: Endpoint to retrieve details related to a previously created
order. The endpoint is typically used to check that the order has
been verified successfully, in addition to other relevant `state`
and `status` changes.
tags:
- Order
parameters:
- name: order_id
in: path
required: true
schema:
type: string
description: The ID of the order to be retrieved
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/OrderResponseSchema'
security:
- X-Api-Key: []
put:
summary: Edit order
operationId: edit_order_handler.put
description: Endpoint to edit a previously created order which has not
been fulfilled. The request body may contain changes related items,
quantity, prices, etc.
tags:
- Order
parameters:
- name: order_id
in: path
required: true
schema:
type: string
description: The ID of the order to be edited
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/OrderResponseSchema'
security:
- X-Api-Key: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/EditOrderRequestSchema'
/v1/order/{order_id}/payment_link:
get:
summary: Generate a payment initiation link for a specific order.
operationId: get_order_payment_link_handler.get
description: 'This endpoint creates a secure payment link that allows
buyers to initiate payment for an invoice. The link is only generated
if: - The order is in a supported country - The merchant and buyer
are in the same country - The invoice currency matches the merchant''s
home currency Returns: Contains the payment link URL or null if
not available'
tags:
- Invoice
parameters:
- name: order_id
in: path
required: true
schema:
type: string
description: ''
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: Payment link generated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/PaymentLinkResponseSchema'
'400':
description: Bad request - invalid order or payment link generation
failed
'401':
description: Unauthorized - API key required
'404':
description: Order not found or access denied
security:
- X-Api-Key: []
/v1/order/merchant-order-id/{merchant_order_id}:
get:
summary: Get orders by merchant order ID
operationId: get_orders_by_merchant_order_id_handler.get
description: Endpoint to retrieve all orders matching a given `merchant_order_id`.
This is useful when the merchant's own order identifier was set during
order creation and the merchant needs to look up order details, check
verification status, or track `state` and `status` changes.
tags:
- Order
parameters:
- name: merchant_order_id
in: path
required: true
schema:
type: string
description: The merchant order ID set during order create call
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/OrderResponseList'
'404':
description: No orders found for this merchant_order_id
security:
- X-Api-Key: []
/v1/order/{order_id}/confirm:
post:
summary: Confirm order
operationId: mark_confirmed_order_handler.post
description: The confirm endpoint moves an order to the "CONFIRMED" state,
though this is optional as both verified and confirmed orders guarantee
credit for 21 days and can proceed to fulfilment. It simply signals
that a buyer has returned to the merchant's site after having completed
their order verification.
tags:
- Order
parameters:
- name: order_id
in: path
required: true
schema:
type: string
description: The ID of the order to be confirmed
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/OrderResponseSchema'
security:
- X-Api-Key: []
/v1/order/{order_id}/renew:
post:
summary: Renew order
operationId: renew_order_handler.post
description: Re-run credit check to renew our credit guarantee. If an
external funding provider owns the order, we cancel that external
order, re-create it, and update `order.external_order_id` on our internal
order. **Note that Norwegian Orders funded by Kredinor that have already
been partially fulfilled cannot be renewed via our credit renewal
end point.**
tags:
- Order
parameters:
- name: order_id
in: path
required: true
schema:
type: string
description: The ID of the order to be renewed
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: Order renewed successfully
content:
application/json:
schema:
$ref: '#/components/schemas/OrderResponseSchema'
'400':
description: Order is not renewable or credit check failed on
renewal
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Order not found or access denied
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
security:
- X-Api-Key: []
/v1/order/{order_id}/cancel:
post:
summary: Cancel order
operationId: cancel_order_handler.post
description: Endpoint to change the state of an order to cancelled, and
void the invoice. An order cannot change state to cancelled after
being fulfilled. After fulfilment the merchant will have to refund
the order instead.
tags:
- Order
parameters:
- name: order_id
in: path
required: true
schema:
type: string
description: The ID of the order to be cancelled
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: Cancellation succeeded
'202':
description: Already cancelled
security:
- X-Api-Key: []
/v1/order/{order_id}/fulfillments:
get:
summary: Get fulfilled orders
operationId: get_fulfilled_order_handler.get
description: This endpoint is used to fetch the associated fulfilled orders
and refunds for a given order ID. If the requested order is linked
to a partially fulfilled order, the endpoint returns all associated
fulfilled orders.
tags:
- Order
parameters:
- name: order_id
in: path
required: true
schema:
type: string
description: The ID of the root order
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/FulfilledOrdersResponseSchema'
security:
- X-Api-Key: []
post:
summary: Fulfil order
operationId: fulfill_order_handler.post
description: Endpoint to fully or partially fulfill an order based on
the line item selection and gross, net amount values. If fully fulfilled,
the endpoint changes the state of an order to `FULFILLED`. If partial
fulfilment, the endpoint changes the status of an order to `PARTIAL`
and creates a child order with 'FULFILLED' state. Note that fulfilment
is an async process may take a few minutes to realise.
tags:
- Order
parameters:
- name: order_id
in: path
required: true
schema:
type: string
description: The ID of the order to be partially fulfilled
- name: Idempotency-Key
in: header
schema:
anyOf:
- maxLength: 100
type: string
- type: 'null'
default: null
title: Idempotency-Key
required: false
description: ''
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/FulfillOrderResponseSchema'
security:
- X-Api-Key: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FulfillOrderSchema'
required: false
/v1/order/{order_id}/fulfillments/complete_partial:
post:
summary: Complete partial order
operationId: complete_partial_order_handler.post
description: Cancels any unfulfilled parts of a partially fulfilled order,
completing it. Use this endpoint when the merchant has fulfilled some
line items via partial fulfilment and wants to cancel the remaining
unfulfilled portion rather than fulfilling it.
tags:
- Order
parameters:
- name: order_id
in: path
required: true
schema:
type: string
description: The root ID of the partial order to be completed/cancelled
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: Partial order completed successfully
security:
- X-Api-Key: []
/v1/order/{order_id}/invoice_details:
get:
summary: Fetch invoice details
operationId: get_invoice_details_handler.get
description: Return an object representing the current status of an invoice,
including payment status.
tags:
- Invoice
parameters:
- name: order_id
in: path
required: true
schema:
type: string
description: The ID of the order being queried
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/InvoiceDetailsWithStatusSchema'
'404':
description: Order not found
'409':
description: Order not invoiced
security:
- X-Api-Key: []
/v2/orders:
get:
summary: Get list of orders
operationId: retrieve_order_list_handler.get
description: Additionally following query params can be specified to manage
pagination settings `limit` - set limit items per page (default=100) `page`
- page number (calculated from limit and total results) to display `offset`
- items offset - alternative to `page` (pages not calculated if this
param provided) Returns 401 error code if not authenticated. Returns
404 error code if merchant is not specified.
tags:
- Order
parameters:
- name: start_date
in: query
schema:
anyOf:
- type: string
- type: 'null'
default: null
description: First date that should be included in the list of
orders.
title: Start Date
required: false
description: First date that should be included in the list of orders.
- name: end_date
in: query
schema:
anyOf:
- type: string
- type: 'null'
default: null
description: Last date that should be included in the list of
orders.
title: End Date
required: false
description: Last date that should be included in the list of orders.
- name: limit
in: query
schema:
anyOf:
- type: integer
- type: 'null'
default: null
description: Limit the number of results per page to this number.
title: Limit
required: false
description: Limit the number of results per page to this number.
- name: page
in: query
schema:
anyOf:
- type: integer
- type: 'null'
default: null
description: Page number to display results for.
title: Page
required: false
description: Page number to display results for.
- name: offset
in: query
schema:
anyOf:
- type: integer
- type: 'null'
default: null
description: Number of offset results by (page parameter is disregarded
if provided).
title: Offset
required: false
description: Number of offset results by (page parameter is disregarded
if provided).
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/OrderListRequestSchema'
security:
- X-Api-Key: []
/v1/order/{order_id}/verification_data:
get:
summary: Get order verification data
operationId: get_order_verification_data.get
description: Endpoint to retrieve verification data related to an order.
This endpoint is typically used by merchants to get data related to
the verification links sent for an order.
tags:
- Order
parameters:
- name: order_id
in: path
required: true
schema:
type: string
description: The ID of the order to be retrieved
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/VerificationDataResponseSchema'
security:
- X-Api-Key: []
/v1/order/{order_id}/notify:
post:
summary: Send order verification notification to buyer
operationId: notify_order_handler.post
description: 'Within the notification, the buyer will receive a link that
they need to visit to complete their order verification. Note: For
trade account orders (with merchant_user_id), notifications are always
sent to the phone number registered with the trade account, not the
phone number in order.buyer.representative.'
tags:
- Order
parameters:
- name: order_id
in: path
required: true
schema:
type: string
description: ''
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: Trigger order verification notification to buyer
security:
- X-Api-Key: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/NotifyRequestSchema'
/v1/order/{order_id}/refund:
post:
summary: Refund order
operationId: refund_order_handler.post
description: Endpoint to refund an order. The customer will receive a
credit note with a description of the items that are credited. An
order can also be partially refunded by specifying the exact items
and amount that are refunded in the JSON request body.
tags:
- Order
parameters:
- name: order_id
in: path
required: true
schema:
type: string
description: The ID of the order to be refunded
- name: Idempotency-Key
in: header
schema:
anyOf:
- maxLength: 100
type: string
- type: 'null'
default: null
title: Idempotency-Key
required: false
description: ''
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'201':
description: Refund order
content:
application/json:
schema:
$ref: '#/components/schemas/RefundSummaryResponseSchema'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RefundRequestSchema'
/v1/invoice/{order_id}/pdf:
get:
summary: Download PDF invoice via Order ID
operationId: invoice_pdf_handler.get
description: Endpoint to fetch the invoice for a fulfilled order using
the global order ID. The order ID is returned as part of the create
order response and is under the key of `id` at the highest level of
the JSON response.
tags:
- Invoice
parameters:
- name: order_id
in: path
required: true
schema:
type: string
description: The order id of a fulfilled order
- name: v
in: query
schema:
anyOf:
- type: string
- type: 'null'
default: null
description: Optional parameter `v=original` to download the original
invoice and not the credit note (if any)
examples:
- original
title: V
required: false
description: Optional parameter `v=original` to download the original
invoice and not the credit note (if any)
- name: lang
in: query
schema:
anyOf:
- type: string
- type: 'null'
default: null
description: Specify language to generate PDF [`en_US`, `nb_NO`,
`sv_SE`]
examples:
- en_US
title: Lang
required: false
description: Specify language to generate PDF [`en_US`, `nb_NO`, `sv_SE`]
- name: generate
in: query
schema:
anyOf:
- type: boolean
- type: 'null'
default: 'false'
description: Optional parameter generate (defaults to false) to
help with testing or the need to re-create if the template
changes etc
title: Generate
required: false
description: Optional parameter generate (defaults to false) to help
with testing or the need to re-create if the template changes
etc
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: OK
/v1/invoice/{invoice_id}/document:
get:
summary: Download PDF Invoice via Invoice ID
operationId: invoice_document_handler.get
description: Endpoint to fetch the invoice for a fulfilled order by using
the global invoice ID. The invoice ID is provided in the response
as part of the `invoice_details` object with field `id`.
tags:
- Invoice
parameters:
- name: invoice_id
in: path
required: true
schema:
type: string
description: The id of an invoice connected to a fulfilled order
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: OK
/v1/invoice/pdfs:
get:
summary: Download PDF Invoices in a zip file
operationId: zipped_invoice_pdfs_handler.get
description: Only fulfilled orders can have invoices.
tags:
- Invoice
parameters:
- name: v
in: query
schema:
anyOf:
- type: string
- type: 'null'
default: null
description: Optional parameter `v=original` to download the original
invoice and not the credit note (if any)
examples:
- original
title: V
required: false
description: Optional parameter `v=original` to download the original
invoice and not the credit note (if any)
- name: lang
in: query
schema:
anyOf:
- type: string
- type: 'null'
default: null
description: Specify language to generate PDF [`en_US`, `nb_NO`,
`sv_SE`]
examples:
- en_US
title: Lang
required: false
description: Specify language to generate PDF [`en_US`, `nb_NO`, `sv_SE`]
- name: generate
in: query
schema:
anyOf:
- type: boolean
- type: 'null'
default: 'false'
description: Optional parameter generate (defaults to false) to
help with testing or the need to re-create if the template
changes etc
title: Generate
required: false
description: Optional parameter generate (defaults to false) to help
with testing or the need to re-create if the template changes
etc
- name: order_id
in: query
schema:
description: Order IDs of the invoices, provided multiple times
as a query parameter
format: uuid
title: Order Id
type: string
required: true
description: Order IDs of the invoices, provided multiple times as
a query parameter
responses:
default:
description: Error response
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'200':
description: OK
security:
- X-Api-Key: []
/v1/invoice/{invoice_id}:
patch:
summary: Change an invoice post fulfillment
operationId: edit_invoice.patch
description: This will credit note the current invoice and create a new
invoice, with new invoice number, with the requested fields updated.