{"record":{"id":"47794b13e92ffa71","repo":"HeyPuter/puter","slug":"card-verification-required","errorCode":"card_verification_required","errorMessage":"Please verify your card to continue","messagePattern":"Please verify your card to continue","errorType":"exception","errorClass":"HttpError","httpStatus":403,"severity":"error","filePath":"src/backend/core/http/middleware/gates.ts","lineNumber":386,"sourceCode":"          }\n        | undefined,\n): void => {\n    if (user?.requires_email_confirmation && !user?.email_confirmed) {\n        throw new HttpError(403, 'Please confirm your email to continue', {\n            legacyCode: 'email_confirmation_required',\n        });\n    }\n    if (user?.requires_phone_verification) {\n        throw new HttpError(\n            403,\n            'Please verify your phone number to continue',\n            {\n                legacyCode: 'phone_verification_required' as never,\n            },\n        );\n    }\n    if (user?.requires_card_verification) {\n        throw new HttpError(403, 'Please verify your card to continue', {\n            legacyCode: 'card_verification_required' as never,\n        });\n    }\n};\n\nexport const assertNotSuspended = (\n    user: { suspended?: unknown } | undefined,\n): void => {\n    if (user?.suspended) {\n        throw new HttpError(403, 'Account suspended', {\n            legacyCode: 'forbidden',\n        });\n    }\n};\n\n/**\n * Reject unless the actor is acting through one of the named apps.\n * App-under-user actors are permitted iff `actor.app.uid` is in the allowList;","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/HeyPuter/puter/blob/908ec23eda38526170322c3edf71ba45ecb1ca95/src/backend/core/http/middleware/gates.ts#L368-L404","documentation":"Raised by `assertVerifiedAccount` when the user row has `requires_card_verification` truthy. The account must add and verify a card before the guarded route proceeds. Like the phone branch, the `as never` cast indicates the legacy code is not yet registered in the canonical error map.","triggerScenarios":"An account flagged `requires_card_verification` calls any route guarded by `assertVerifiedAccount` before completing card verification.","commonSituations":"A billing or paid-feature gate enabled card verification for an account; the flag was set but the user hasn't added a valid payment method.","solutions":["Complete the card verification / add-payment-method flow.","As admin, clear `requires_card_verification` if the gate is misapplied.","Ensure the gated feature is only reachable after the billing flow."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await call(); }\ncatch (e) {\n  if (e.code === 'card_verification_required') { routeToAddPaymentMethod(); return; }\n  throw e;\n}","preventionTips":["Complete card verification before billing-gated features.","Verify the flag is intended for this account.","Clear the flag once a valid payment method is on file."],"tags":["verification","card","billing","account","gate"],"backgroundTag":null,"analyzedSha":"908ec23eda38526170322c3edf71ba45ecb1ca95","analyzedAt":"2026-08-12T20:53:15.911Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}