{"record":{"id":"2cee6ed19a4f4a17","repo":"toeverything/AFFiNE","slug":"failed-to-checkout","errorCode":"failed_to_checkout","errorMessage":"Failed to create checkout session.","messagePattern":"Failed to create checkout session\\.","errorType":"exception","errorClass":"FailedToCheckout","httpStatus":500,"severity":"error","filePath":"packages/backend/server/src/plugins/payment/resolver.ts","lineNumber":309,"sourceCode":"      session = await this.service.checkout(input, {\n        plan: input.plan as any,\n        quantity: input.args?.quantity ?? 10,\n        user,\n      });\n    } else {\n      if (!user) {\n        throw new AuthenticationRequired();\n      }\n\n      session = await this.service.checkout(input, {\n        plan: input.plan as any,\n        user,\n        workspaceId: input.args?.workspaceId,\n      });\n    }\n\n    if (!session.url) {\n      throw new FailedToCheckout();\n    }\n\n    return session.url;\n  }\n\n  @Mutation(() => String, {\n    description: 'Create a stripe customer portal to manage payment methods',\n  })\n  async createCustomerPortal(@CurrentUser() user: CurrentUser) {\n    return this.service.createCustomerPortal(user.id);\n  }\n\n  @Mutation(() => SubscriptionType)\n  async cancelSubscription(\n    @CurrentUser() user: CurrentUser,\n    @Args({\n      name: 'plan',\n      type: () => SubscriptionPlan,","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/backend/server/src/plugins/payment/resolver.ts#L291-L327","documentation":"createCheckoutSession checks the returned Stripe session for a URL and throws FailedToCheckout when it is missing, converting a technically-successful-but-unusable Stripe response into an explicit checkout failure.","triggerScenarios":"Thrown at packages/backend/server/src/plugins/payment/resolver.ts:309 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the payment provider credentials and configuration on the server.","Verify the requested plan and price exist in the payment system.","Inspect server logs for the upstream error and retry after fixing the configuration."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}