You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .agents/plugins/commercetools/skills/commercetools-checkout/references/payment-only-mode.md
+16-17Lines changed: 16 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ Adds payment processing via the [Checkout Browser SDK](https://docs.commercetool
40
40
```
41
41
Browser (SDK) → Checkout service → PSP
42
42
↑
43
-
/api/checkout/session (creates Checkout Session from cart)
43
+
/<api>/checkout/session (creates Checkout Session from cart)
44
44
↑
45
45
commercetools Sessions API (POST https://session.{region}.commercetools.com/{projectKey}/sessions)
46
46
```
@@ -51,33 +51,33 @@ The storefront creates a **Checkout Session** (server-side, via a new API route)
51
51
52
52
## Step 0 — Prerequisites
53
53
54
-
### 0a. Add environment variables to `site/.env`
54
+
### 0a. Add environment variables to `<root-dir>/.env`
55
55
56
56
```bash
57
57
# The key of your Checkout Application
58
58
CTP_CHECKOUT_APP_KEY=storefront-checkout
59
59
```
60
60
61
-
`CTP_PROJECT_KEY`, `CTP_API_URL`, and `CTP_SCOPES` are already in `site/.env`. The region is derived automatically from `CTP_API_URL` at startup — **do not add a separate `CT_REGION` variable**. `projectKey` and `region` are returned to the browser by `/api/checkout/session`, so **no `NEXT_PUBLIC_*` variables are needed**.
61
+
`CTP_PROJECT_KEY`, `CTP_API_URL`, and `CTP_SCOPES` are already in `<root-dir>/.env`. The region is derived automatically from `CTP_API_URL` at startup — **do not add a separate `CT_REGION` variable**. `projectKey` and `region` are returned to the browser by `/<api>/checkout/session`.
@@ -176,7 +178,7 @@ export default function StepPayment() {
176
178
}
177
179
```
178
180
179
-
**No `NEXT_PUBLIC_*`env vars are needed.**`projectKey` and `region` are returned by `/api/checkout/session` alongside the `sessionId` and read from the response in the client component.
181
+
**No extra environment env vars are needed.**`projectKey` and `region` are returned by `/<api>/checkout/session` alongside the `sessionId` and read from the response in the client component.
180
182
181
183
#### 2A-2. Integrate into the checkout step page
182
184
@@ -218,22 +220,19 @@ Available CSS variables are listed in the Checkout theming docs.
218
220
|---|---|---|
219
221
|`CTP_CHECKOUT_APP_KEY`| No |**New** — key of the Checkout Application |
220
222
221
-
222
-
No `CT_REGION`, `NEXT_PUBLIC_CT_PROJECT_KEY`, or `NEXT_PUBLIC_CT_REGION` variables are needed. The session API derives the region from `CTP_API_URL` and returns `{ sessionId, projectKey, region }` to the browser.
223
-
224
223
---
225
224
226
225
## Checklist
227
226
228
227
### Prerequisites
229
-
-[ ]`CTP_CHECKOUT_APP_KEY` added to `site/.env` (the only new variable required)
228
+
-[ ]`CTP_CHECKOUT_APP_KEY` added to `<root-dir>/.env` (the only new variable required)
-[ ]**paymentFlow**: Replace `StepPayment.tsx` with commercetools widget mount; remove payment actions from `/api/checkout/route.ts`
235
+
-[ ]**paymentFlow**: Replace `StepPayment.tsx` with commercetools widget mount;
237
236
238
237
### Order confirmation
239
238
-[ ] Update confirmation page to read `?orderId=` from commercetools redirect URL or `onInfo` callback
@@ -246,6 +245,6 @@ No `CT_REGION`, `NEXT_PUBLIC_CT_PROJECT_KEY`, or `NEXT_PUBLIC_CT_REGION` variabl
246
245
247
246
**`<div data-ctc />`** — For `paymentFlow`, always render `<div data-ctc />` in the component's JSX. Without it the commercetools widget mounts at the document root and occupies the full page.
248
247
249
-
**No `NEXT_PUBLIC_*` vars** — `projectKey` and `region` are server-side config. Return them from `/api/checkout/session` alongside `sessionId` so the browser never needs `NEXT_PUBLIC_` prefixed variables for these values.
248
+
**No `PUBLIC_*` vars** — `projectKey` and `region` are server-side config. Return them from `/<api>/checkout/session` alongside `sessionId` so the browser never needs environment vars for these values.
250
249
251
250
**`paymentReturnUrl` must be registered** — Only one return URL per Connector. The URL must exactly match what's registered in the commercetools Application `paymentsConfiguration.paymentReturnUrl`.
0 commit comments