@@ -837,6 +837,26 @@ paths:
837
837
838
838
See [Including Resources](https://elasticpath.dev/guides/Getting-Started/includes).
839
839
840
+ ### Add Subscription to Cart
841
+
842
+ To add a subscription to your cart, you need to provide the ID of the subscription offering and the ID of the plan within that offering that you want to subscribe to.
843
+
844
+ ```json
845
+ {
846
+ {
847
+ "data": {
848
+ "id": "5b9be99f-1c94-4ddd-9718-81adab0cc3e0",
849
+ "type": "subscription_item",
850
+ "quantity": 1,
851
+ "subscription_configuration": {
852
+ "plan": "40010dde-2f38-489b-8b3f-14a13cbfb431"
853
+ }
854
+ }
855
+ }
856
+ ```
857
+
858
+ The price of the subscription item in the cart reflects the cost of the subscription's initial billing period. Once the cart has been checked out and the order paid for, the subscription will be automatically created in the subscriptions service.
859
+
840
860
### Add Custom Item to Cart
841
861
842
862
You can add a custom item to the cart when you don't manage things like shipping, taxes and inventory in Commerce.
@@ -1022,6 +1042,14 @@ paths:
1022
1042
name :
1023
1043
tshirt_front : Jane
1024
1044
tshirt_back : Jane Doe's Dance Academy
1045
+ Add Subscription Item :
1046
+ value :
1047
+ data :
1048
+ type : subscription_item
1049
+ id : 1f49c20c-54b9-453b-a57c-ef8303a6415f
1050
+ quantity : 1
1051
+ subscription_configuration :
1052
+ plan : a2cd9dae-3a28-4185-93b7-1b02a8ce0c2e
1025
1053
Add Custom Item :
1026
1054
value :
1027
1055
data :
@@ -2022,15 +2050,18 @@ paths:
2022
2050
allOf :
2023
2051
- $ref : ' #/components/schemas/CartsCustomDiscountsObject'
2024
2052
required : false
2025
- responses :
2026
- ' 200 ' :
2027
- description : ' '
2028
- headers : { }
2029
- content :
2030
- application/json :
2031
- schema :
2032
- allOf :
2033
- - $ref : ' #/components/schemas/CartsCustomDiscountsResponse'
2053
+ responses :
2054
+ ' 200 ' :
2055
+ description : ' '
2056
+ headers : { }
2057
+ content :
2058
+ application/json :
2059
+ schema :
2060
+ allOf :
2061
+ - $ref : ' #/components/schemas/Response.Data'
2062
+ - properties :
2063
+ data :
2064
+ $ref : ' #/components/schemas/CartsCustomDiscountsResponse'
2034
2065
' 401 ' :
2035
2066
description : Unauthorized
2036
2067
content :
@@ -2083,18 +2114,18 @@ paths:
2083
2114
data :
2084
2115
$ref : ' #/components/schemas/CartsCustomDiscountsObject'
2085
2116
required : false
2086
- responses :
2087
- ' 200 ' :
2088
- description : ' '
2089
- headers : { }
2090
- content :
2091
- application/json :
2092
- schema :
2093
- allOf :
2094
- - $ref : ' #/components/schemas/Response.Data'
2095
- - properties :
2096
- data :
2097
- $ref : ' #/components/schemas/CartsCustomDiscountsResponse'
2117
+ responses :
2118
+ ' 200 ' :
2119
+ description : ' '
2120
+ headers : { }
2121
+ content :
2122
+ application/json :
2123
+ schema :
2124
+ allOf :
2125
+ - $ref : ' #/components/schemas/Response.Data'
2126
+ - properties :
2127
+ data :
2128
+ $ref : ' #/components/schemas/CartsCustomDiscountsResponse'
2098
2129
' 401 ' :
2099
2130
description : Unauthorized
2100
2131
content :
@@ -3258,6 +3289,7 @@ components:
3258
3289
title : Cart Items Object Request
3259
3290
oneOf :
3260
3291
- $ref : " #/components/schemas/CartItemObject"
3292
+ - $ref : " #/components/schemas/SubscriptionItemObject"
3261
3293
- $ref : " #/components/schemas/CartMergeObjectRequest"
3262
3294
- $ref : " #/components/schemas/CustomItemObject"
3263
3295
- $ref : " #/components/schemas/ReOrderObjectRequest"
@@ -3314,6 +3346,49 @@ components:
3314
3346
shipping_group_id :
3315
3347
description : Identifier for a created Cart Shipping Group
3316
3348
type : string
3349
+ SubscriptionItemObject :
3350
+ title : Subscription Item Object
3351
+ type : object
3352
+ properties :
3353
+ data :
3354
+ allOf :
3355
+ - $ref : ' #/components/schemas/SubscriptionItemObjectData'
3356
+ - $ref : ' #/components/schemas/CartItemResponse'
3357
+ SubscriptionItemObjectData :
3358
+ title : Subscription Item Object Data
3359
+ type : object
3360
+ required :
3361
+ - id
3362
+ - type
3363
+ - quantity
3364
+ - subscription_configuration
3365
+ properties :
3366
+ type :
3367
+ description : The type of object being returned.
3368
+ type : string
3369
+ enum :
3370
+ - subscription_item
3371
+ quantity :
3372
+ description : The number of items added to the cart.
3373
+ type : number
3374
+ examples :
3375
+ - 1
3376
+ id :
3377
+ type : string
3378
+ format : uuid
3379
+ description : Specifies the ID of the subscription offering you want to add to cart.
3380
+ examples :
3381
+ - 4ca958bc-7d69-4e2d-b5d4-c74bd5a6cde6
3382
+ subscription_configuration :
3383
+ type : object
3384
+ description : Specifies how the subscription offering should be configured.
3385
+ required :
3386
+ - plan
3387
+ properties :
3388
+ plan :
3389
+ type : string
3390
+ format : uuid
3391
+ description : The ID of the plan within the offering to use for the subscription.
3317
3392
CartMergeObjectRequest :
3318
3393
title : Cart Merge Object Request
3319
3394
type : object
@@ -3554,6 +3629,13 @@ components:
3554
3629
readOnly : true
3555
3630
examples :
3556
3631
- 55cda543-f9d7-42a4-b40a-665f2e4ff7c5
3632
+ subscription_offering_id :
3633
+ description : The unique ID of the subscription offering for subscription items.
3634
+ type : string
3635
+ format : uuid
3636
+ readOnly : true
3637
+ examples :
3638
+ - 9c13669e-29d7-42ea-bc95-1b32399adb9d
3557
3639
name :
3558
3640
description : The name of this item
3559
3641
type : string
@@ -4684,6 +4766,13 @@ components:
4684
4766
readOnly : true
4685
4767
examples :
4686
4768
- 4e9c6098-9701-4839-a69c-54d8256d9012
4769
+ subscription_offering_id :
4770
+ description : The unique identifier for the subscription offering for this order item.
4771
+ type : string
4772
+ format : uuid
4773
+ readOnly : true
4774
+ examples :
4775
+ - 69a39623-e681-415e-83c0-e1281010c77d
4687
4776
name :
4688
4777
description : The name of this order item.
4689
4778
type : string
0 commit comments