{"record":{"id":"2adf0b876be4073f","repo":"payloadcms/payload","slug":"no-transaction-found-for-the-provided-paymentinten","errorCode":null,"errorMessage":"No transaction found for the provided PaymentIntent ID","messagePattern":"No transaction found for the provided PaymentIntent ID","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/plugin-ecommerce/src/payments/adapters/stripe/confirmOrder.ts","lineNumber":74,"sourceCode":"          email: customerEmail,\n        })\n      }\n\n      // Find our existing transaction by the payment intent ID\n      const transactionsResults = await payload.find({\n        collection: transactionsSlug,\n        req,\n        where: {\n          'stripe.paymentIntentID': {\n            equals: paymentIntentID,\n          },\n        },\n      })\n\n      const transaction = transactionsResults.docs[0]\n\n      if (!transactionsResults.totalDocs || !transaction) {\n        throw new Error('No transaction found for the provided PaymentIntent ID')\n      }\n\n      const paymentIntent = await stripe.paymentIntents.retrieve(paymentIntentID)\n\n      if (paymentIntent.status !== 'succeeded') {\n        throw new Error(`Payment not completed.`)\n      }\n\n      const cartID = paymentIntent.metadata.cartID\n      const cartItemsSnapshot = paymentIntent.metadata.cartItemsSnapshot\n        ? JSON.parse(paymentIntent.metadata.cartItemsSnapshot)\n        : undefined\n\n      const shippingAddress = paymentIntent.metadata.shippingAddress\n        ? JSON.parse(paymentIntent.metadata.shippingAddress)\n        : undefined\n\n      if (!cartID) {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/payloadcms/payload/blob/00c58b35c0ed348ddc22daabf467b139727214fd/packages/plugin-ecommerce/src/payments/adapters/stripe/confirmOrder.ts#L56-L92","documentation":"Thrown by Stripe confirmOrder after querying the transactions collection by stripe.paymentIntentID — if no transaction document is found (totalDocs === 0 or no doc returned), the PaymentIntent ID is unknown to the system. This means initiatePayment never persisted a transaction for that intent, or the transactions slug/name differs. It separates 'Stripe knows this intent' from 'the local system recorded it'.","triggerScenarios":"confirmOrder is called with a paymentIntentID that was never created via this plugin's initiatePayment (e.g. an intent created directly in the Stripe dashboard or a different integration), or the transaction was deleted, or transactionsSlug passed to confirmOrder differs from the one used in initiatePayment.","commonSituations":"Mixing Stripe dashboards / accounts between initiate and confirm; running confirm against a test intent from the Stripe UI; the transactions collection slug was customized on one side but not the other; database reset between the two steps; race condition where confirm runs before initiate's transaction create commits.","solutions":["Ensure initiatePayment ran to completion for this paymentIntentID and a transaction document exists in the transactions collection.","Confirm the transactionsSlug is identical for both initiatePayment and confirmOrder (default 'transactions').","Inspect the transactions collection for stripe.paymentIntentID === <id> to verify persistence.","If the intent was created outside the plugin, recreate it via initiatePayment so a transaction is recorded."],"exampleFix":"// before: confirm an intent created outside the plugin\nawait payments.confirmOrder({ data: { paymentIntentID: externalIntentId } })\n// after: always go through initiatePayment first so a transaction row exists\nconst { paymentIntentID } = await payments.initiatePayment({ data: cartData })\n// ...user pays with Stripe checkout...\nawait payments.confirmOrder({ data: { paymentIntentID } })","handlingStrategy":"try-catch","validationCode":"// Pre-flight: confirm a transaction exists for this intent before calling confirmOrder\nasync function transactionExistsForIntent(payload, transactionsSlug: string, paymentIntentID: string): Promise<boolean> {\n  const res = await payload.find({\n    collection: transactionsSlug,\n    where: { 'stripe.paymentIntentID': { equals: paymentIntentID } },\n    limit: 1,\n  })\n  return res.totalDocs > 0\n}\n\nif (!(await transactionExistsForIntent(payload, 'transactions', id))) {\n  throw new Error('No local transaction; run initiatePayment first')\n}","typeGuard":"export function hasLocalTransaction(res: { totalDocs: number; docs: unknown[] }): boolean {\n  return res.totalDocs > 0 && res.docs.length > 0\n}","tryCatchPattern":"try {\n  await payments.confirmOrder({ data: { paymentIntentID } })\n} catch (err) {\n  if (err instanceof Error && err.message === 'No transaction found for the provided PaymentIntent ID') {\n    // intent is foreign or initiate didn't persist — re-run initiate or surface to support\n    return { ok: false, reason: 'orphan-intent' }\n  }\n  throw err\n}","preventionTips":["Always create intents via initiatePayment so a transaction row is written.","Use identical transactionsSlug on both initiate and confirm (default 'transactions').","Idempotency-check the transactions collection before allowing confirm to run twice.","In multi-environment setups, ensure initiate and confirm target the same database."],"tags":["stripe","transactions","data-integrity","ecommerce","lookup"],"backgroundTag":null,"analyzedSha":"00c58b35c0ed348ddc22daabf467b139727214fd","analyzedAt":"2026-08-12T20:45:03.758Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}