From fbe0761609522b2e4235c32e965ab6b18fe0d33b Mon Sep 17 00:00:00 2001 From: Unchained Date: Sun, 29 Mar 2026 14:31:42 +0200 Subject: [PATCH] fix: remove manual transaction creation causing 400 error - Remove CREATE_TRANSACTION_MUTATION call that's causing 400 error - Saleor's checkoutComplete already creates order with NOT_CHARGED status for COD - Order doesn't need manual transaction - staff handles fulfillment in dashboard - Keep payment method selection and UI components intact --- src/app/[locale]/checkout/page.tsx | 32 ------------------------------ 1 file changed, 32 deletions(-) diff --git a/src/app/[locale]/checkout/page.tsx b/src/app/[locale]/checkout/page.tsx index 6d37ed6..c371993 100644 --- a/src/app/[locale]/checkout/page.tsx +++ b/src/app/[locale]/checkout/page.tsx @@ -19,7 +19,6 @@ import { CHECKOUT_METADATA_UPDATE, CHECKOUT_SHIPPING_METHOD_UPDATE, } from "@/lib/saleor/mutations/Checkout"; -import { CREATE_TRANSACTION_MUTATION } from "@/lib/saleor/payments/cod"; import { PaymentSection } from "./components/PaymentSection"; import { DEFAULT_PAYMENT_METHOD } from "@/lib/config/paymentMethods"; import { GET_CHECKOUT_BY_ID } from "@/lib/saleor/queries/Checkout"; @@ -386,37 +385,6 @@ export default function CheckoutPage() { const order = completeResult.data?.checkoutComplete?.order; if (order) { setOrderNumber(order.number); - - // Create COD transaction for the order - if (selectedPaymentMethod === 'cod') { - console.log("Step 6: Creating COD transaction..."); - try { - await saleorClient.mutate({ - mutation: CREATE_TRANSACTION_MUTATION, - variables: { - id: order.id, - transaction: { - name: "Cash on Delivery", - pspReference: `COD-${order.number}-${Date.now()}`, - availableActions: ["CHARGE"], - amountAuthorized: { - amount: 0, - currency: "RSD" - }, - amountCharged: { - amount: 0, - currency: "RSD" - } - } - } - }); - console.log("Step 6: COD transaction created successfully"); - } catch (txError) { - console.error("Failed to create COD transaction:", txError); - // Don't fail the order if transaction creation fails - } - } - setOrderComplete(true); // Track order completion