Skip to content

Commit abaf9c8

Browse files
copy orders spec (#280)
1 parent 61d2eca commit abaf9c8

File tree

2 files changed

+111
-22
lines changed

2 files changed

+111
-22
lines changed

guides/Getting-Started/test-with-postman-collection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Use the Postman collection to run and explore Commerce APIs. The collection incl
3131

3232
:::
3333

34-
1. Go to Postman client on your system and import the Commerce Postman [Collection](https://elasticpath.dev/static/postman/collection.json).
34+
1. Go to Postman client on your system and import the Commerce Postman [Collection](https://elasticpath.dev/postman/collection.json).
3535
1. Import the [Environment](https://elasticpath.dev/postman/environment.json) file.
3636
1. Update the values of the following environment variables with the values copied from Commerce Manager.
3737

openapispecs/cartsorders/OpenAPISpec.yaml

Lines changed: 110 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,26 @@ paths:
837837
838838
See [Including Resources](https://elasticpath.dev/guides/Getting-Started/includes).
839839
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+
840860
### Add Custom Item to Cart
841861
842862
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:
10221042
name:
10231043
tshirt_front: Jane
10241044
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
10251053
Add Custom Item:
10261054
value:
10271055
data:
@@ -2022,15 +2050,18 @@ paths:
20222050
allOf:
20232051
- $ref: '#/components/schemas/CartsCustomDiscountsObject'
20242052
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'
20342065
'401':
20352066
description: Unauthorized
20362067
content:
@@ -2083,18 +2114,18 @@ paths:
20832114
data:
20842115
$ref: '#/components/schemas/CartsCustomDiscountsObject'
20852116
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'
20982129
'401':
20992130
description: Unauthorized
21002131
content:
@@ -3258,6 +3289,7 @@ components:
32583289
title: Cart Items Object Request
32593290
oneOf:
32603291
- $ref: "#/components/schemas/CartItemObject"
3292+
- $ref: "#/components/schemas/SubscriptionItemObject"
32613293
- $ref: "#/components/schemas/CartMergeObjectRequest"
32623294
- $ref: "#/components/schemas/CustomItemObject"
32633295
- $ref: "#/components/schemas/ReOrderObjectRequest"
@@ -3314,6 +3346,49 @@ components:
33143346
shipping_group_id:
33153347
description: Identifier for a created Cart Shipping Group
33163348
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.
33173392
CartMergeObjectRequest:
33183393
title: Cart Merge Object Request
33193394
type: object
@@ -3554,6 +3629,13 @@ components:
35543629
readOnly: true
35553630
examples:
35563631
- 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
35573639
name:
35583640
description: The name of this item
35593641
type: string
@@ -4684,6 +4766,13 @@ components:
46844766
readOnly: true
46854767
examples:
46864768
- 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
46874776
name:
46884777
description: The name of this order item.
46894778
type: string

0 commit comments

Comments
 (0)