|
1
|
post: |
|
2
|
operationId: PostPaymentCollections |
|
3
|
summary: Create Payment Collection |
|
4
|
description: >- |
|
5
|
Create a payment collection for a cart. This is used during checkout, where |
|
6
|
the payment collection holds the cart's payment sessions. |
|
7
|
externalDocs: |
|
8
|
url: >- |
|
9
|
https://docs.medusajs.com/resources/storefront-development/checkout/payment |
|
10
|
description: 'Storefront guide: How to implement payment during checkout.' |
|
11
|
x-authenticated: false |
|
12
|
parameters: |
|
13
|
- name: x-publishable-api-key |
|
14
|
in: header |
|
15
|
description: Publishable API Key created in the Medusa Admin. |
|
16
|
required: true |
|
17
|
schema: |
|
18
|
type: string |
|
19
|
externalDocs: |
|
20
|
url: https://docs.medusajs.com/api/store#publishable-api-key |
|
21
|
- name: x-medusa-locale |
|
22
|
in: header |
|
23
|
description: The locale in BCP 47 format to retrieve localized content. |
|
24
|
required: false |
|
25
|
schema: |
|
26
|
type: string |
|
27
|
example: en-US |
|
28
|
externalDocs: |
|
29
|
url: >- |
|
30
|
https://docs.medusajs.com/resources/commerce-modules/translation/storefront |
|
31
|
description: Learn more in the Serve Translations in Storefront guide. |
|
32
|
- name: fields |
|
33
|
in: query |
|
34
|
description: >- |
|
35
|
Comma-separated fields that should be included in the returned data. if |
|
36
|
a field is prefixed with `+` it will be added to the default fields, |
|
37
|
using `-` will remove it from the default fields. without prefix it will |
|
38
|
replace the entire default fields. |
|
39
|
required: false |
|
40
|
schema: |
|
41
|
type: string |
|
42
|
title: fields |
|
43
|
description: >- |
|
44
|
Comma-separated fields that should be included in the returned data. |
|
45
|
if a field is prefixed with `+` it will be added to the default |
|
46
|
fields, using `-` will remove it from the default fields. without |
|
47
|
prefix it will replace the entire default fields. |
|
48
|
externalDocs: |
|
49
|
url: '#select-fields-and-relations' |
|
50
|
- name: locale |
|
51
|
in: query |
|
52
|
description: The locale in BCP 47 format to retrieve localized content. |
|
53
|
required: false |
|
54
|
schema: |
|
55
|
type: string |
|
56
|
example: en-US |
|
57
|
externalDocs: |
|
58
|
url: >- |
|
59
|
https://docs.medusajs.com/resources/commerce-modules/translation/storefront |
|
60
|
description: Learn more in the Serve Translations in Storefront guide. |
|
61
|
requestBody: |
|
62
|
content: |
|
63
|
application/json: |
|
64
|
schema: |
|
65
|
$ref: ../components/schemas/StoreCreatePaymentCollection.yaml |
|
66
|
x-codeSamples: |
|
67
|
- lang: JavaScript |
|
68
|
label: JS SDK |
|
69
|
source: |
|
70
|
$ref: ../code_samples/JavaScript/store_payment-collections/post.js |
|
71
|
- lang: Shell |
|
72
|
label: cURL |
|
73
|
source: |
|
74
|
$ref: ../code_samples/Shell/store_payment-collections/post.sh |
|
75
|
tags: |
|
76
|
- Payment Collections |
|
77
|
responses: |
|
78
|
'200': |
|
79
|
description: OK |
|
80
|
content: |
|
81
|
application/json: |
|
82
|
schema: |
|
83
|
$ref: ../components/schemas/StorePaymentCollectionResponse.yaml |
|
84
|
'400': |
|
85
|
$ref: ../components/responses/400_error.yaml |
|
86
|
'401': |
|
87
|
$ref: ../components/responses/unauthorized.yaml |
|
88
|
'404': |
|
89
|
$ref: ../components/responses/not_found_error.yaml |
|
90
|
'409': |
|
91
|
$ref: ../components/responses/invalid_state_error.yaml |
|
92
|
'422': |
|
93
|
$ref: ../components/responses/invalid_request_error.yaml |
|
94
|
'500': |
|
95
|
$ref: ../components/responses/500_error.yaml |
|
96
|
x-workflow: createPaymentCollectionForCartWorkflow |
|
97
|
x-events: [] |
|
98
|
x-allowed: |
|
99
|
- id |
|
100
|
- currency_code |
|
101
|
- amount |
|
102
|
- payment_sessions |
|
103
|
- status |
|
104
|
- payment_providers |
|
105
|
- payment_providers.id |
|
106
|
- payment_sessions.id |
|
107
|
- payment_sessions.amount |
|
108
|
- payment_sessions.currency_code |
|
109
|
- payment_sessions.provider_id |
|
110
|
- payment_sessions.data |
|
111
|
- payment_sessions.status |