cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

Error on Stripe Activation in Event Type

Open prononext opened this issue 2 years ago • 2 comments
trafficstars

Strange that this Bug just gets converted to a discusion without any comment.

Discussed in https://github.com/calcom/cal.com/discussions/6987

Originally posted by prononext February 9, 2023 I got this strange bug when trying to activate Stripe inside a Event-Type on a self hosted docker instance.

[ { "code": "invalid_type", "expected": "string", "received": "undefined", "path": [ "client_id" ], "message": "Required" }, { "code": "invalid_type", "expected": "string", "received": "undefined", "path": [ "client_secret" ], "message": "Required" }, { "code": "invalid_type", "expected": "string", "received": "undefined", "path": [ "public_key" ], "message": "Required" }, { "code": "invalid_type", "expected": "string", "received": "undefined", "path": [ "webhook_secret" ], "message": "Required" }, { "code": "invalid_type", "expected": "number", "received": "undefined", "path": [ "payment_fee_fixed" ], "message": "Required" }, { "code": "invalid_type", "expected": "number", "received": "undefined", "path": [ "payment_fee_percentage" ], "message": "Required" } ]

I have filled all this environment variables correctly:

NEXT_PUBLIC_STRIPE_PUBLIC_KEY=pk_...
STRIPE_PRIVATE_KEY=sk_...
STRIPE_CLIENT_ID=ca_...
STRIPE_WEBHOOK_SECRET=whsec_...

On the container logs it is showing:

@calcom/web:start:   addIssue: [Function (anonymous)],
@calcom/web:start:   addIssues: [Function (anonymous)],
@calcom/web:start:   name: 'ZodError',
@calcom/web:start:   errors: [
@calcom/web:start:     {
@calcom/web:start:       code: 'invalid_type',
@calcom/web:start:       expected: 'string',
@calcom/web:start:       received: 'undefined',
@calcom/web:start:       path: [Array],
@calcom/web:start:       message: 'Required'
@calcom/web:start:     },
@calcom/web:start:     {
@calcom/web:start:       code: 'invalid_type',
@calcom/web:start:       expected: 'string',
@calcom/web:start:       received: 'undefined',
@calcom/web:start:       path: [Array],
@calcom/web:start:       message: 'Required'
@calcom/web:start:     },
@calcom/web:start:     {
@calcom/web:start:       code: 'invalid_type',
@calcom/web:start:       expected: 'string',
@calcom/web:start:       received: 'undefined',
@calcom/web:start:       path: [Array],
@calcom/web:start:       message: 'Required'
@calcom/web:start:     },
@calcom/web:start:     {
@calcom/web:start:       code: 'invalid_type',
@calcom/web:start:       expected: 'string',
@calcom/web:start:       received: 'undefined',
@calcom/web:start:       path: [Array],
@calcom/web:start:       message: 'Required'
@calcom/web:start:     },
@calcom/web:start:     {
@calcom/web:start:       code: 'invalid_type',
@calcom/web:start:       expected: 'number',
@calcom/web:start:       received: 'undefined',
@calcom/web:start:       path: [Array],
@calcom/web:start:       message: 'Required'
@calcom/web:start:     },
@calcom/web:start:     {
@calcom/web:start:       code: 'invalid_type',
@calcom/web:start:       expected: 'number',
@calcom/web:start:       received: 'undefined',
@calcom/web:start:       path: [Array],
@calcom/web:start:       message: 'Required'
@calcom/web:start:     }
@calcom/web:start:   ]
@calcom/web:start: }

I am running on: v.2.5.10-sh-ce

Am I doing something wrong? How can I get it to work?

prononext avatar Feb 10 '23 01:02 prononext

this seems self-hoster related which we typically cover in discussions, because it does not affect everyone

PeerRich avatar Feb 10 '23 10:02 PeerRich

@PeerRich thats how Github Repos work, not all Issues affect every user of the product, but treating self hosted users like second class when just converting them to discussions is not the way to go, sorry.

Self hosted users are responsible for the biggest code contributions to a opensource product, that has to stay motivated. Self hosted users give the most feature requests which help to involve the solution and stay successful, also because paid users normally don't run around github all day. as my issue was converted I just lost the motivation to give my 10 feature requests and optimizations to the Cal.com github repo...

prononext avatar Feb 10 '23 12:02 prononext

its not a second class ticket. i would even argue because more people look into discussions for self-host advice you find a reply faster

PeerRich avatar Feb 17 '23 10:02 PeerRich

did you set a payment_fee_percentage in the .env?

PeerRich avatar Feb 17 '23 10:02 PeerRich

No I did not send set anything more than is mentioned in https://developer.cal.com/self-hosting/install-apps/stripe

STRIPE_PRIVATE_KEY=sk_...
STRIPE_CLIENT_ID=ca_...
STRIPE_WEBHOOK_SECRET=whsec_...```

prononext avatar Feb 17 '23 15:02 prononext

interesting. will check with the team cc @zomars and @alannnc

PeerRich avatar Feb 17 '23 15:02 PeerRich

first of all, thank you for this beautiful app, I see lots of potential for it for my photo business. I am trying to set the stripe also and I am encountering the same issues listed above, figured I would add my comment and check if anyone found some extra information. I wish I knew how to work on the code and helped out that way. If there is anything I can provide please ask away.

Jozmichne avatar Mar 12 '23 17:03 Jozmichne

Hello, is anyone experiencing this issue still? I would like to have stripe integrated and i am willing to pay someone to do that or integrate paypal..

Jozmichne avatar Mar 31 '23 17:03 Jozmichne

@Jozmichne you can book me on https://cal.com/alan for more help. Can I get more details about your configuration?

  • are you self hosted? What's your cal com username?
  • A screenshot of the error you are receiving?

alannnc avatar Apr 02 '23 04:04 alannnc

Hi @Alannnc

@Jozmichne you can book me on https://cal.com/alan for more help. Can I get more details about your configuration?

* are you self hosted? What's your cal com username?

* A screenshot of the error you are receiving?

Hi Alan, Thank you for responding, I am self hosting on a synology docker container instance. and here is the error i am receiving, stripe error I changed the environment file to include all the instructions on cal.com self help info

Jozmichne avatar Apr 02 '23 18:04 Jozmichne

@Jozmichne Hey getting back to you, seems like while installing the new credentials something went wrong in the process. Can we validate you have the correct values in here? https://{your-self-hosted-url}/settings/admin/apps/payment

image

alannnc avatar Apr 04 '23 21:04 alannnc

@Jozmichne Hey getting back to you, seems like while installing the new credentials something went wrong in the process. Can we validate you have the correct values in here? https://{your-self-hosted-url}/settings/admin/apps/payment

image

this page doesnt show up at all, the destination will take me to an app list where i can toggle stripe on and off, thats all, i cannot edit or change any values, I did enter all these values in the .env file though

Jozmichne avatar Apr 04 '23 21:04 Jozmichne

Can you verify this is working on latest release?

zomars avatar Apr 12 '23 19:04 zomars

Can you verify this is working on latest release?

I just installed the latest release and the problem is still there. cannot activate stripe. Thanks for asking

Jozmichne avatar Apr 12 '23 20:04 Jozmichne

Can you verify this is working on latest release?

I just installed the latest release and the problem is still there. cannot activate stripe. Thanks for asking

Have you tried using the Admin UI in /settings/admin/apps ?

zomars avatar Apr 12 '23 21:04 zomars

Can you verify this is working on latest release?

I just installed the latest release and the problem is still there. cannot activate stripe. Thanks for asking

Have you tried using the Admin UI in /settings/admin/apps ?

yes i get to that page and stripe is activated then i go under /apps find stripe and when i hit install it will give me that error in the screenshot above. if you would like i can setup a screenshare and show you.

Jozmichne avatar Apr 12 '23 21:04 Jozmichne

That would be helpful! 🙏🏽

zomars avatar Apr 13 '23 00:04 zomars

That would be helpful! 🙏🏽

I am new to GitHub. How can i message you directly or get your email? I don't use Twitter and in my linked in I can't add you for some reason

Jozmichne avatar Apr 13 '23 01:04 Jozmichne

@Jozmichne you can create a loom and post it here https://www.loom.com/

zomars avatar Apr 13 '23 20:04 zomars

@Jozmichne you can create a loom and post it here https://www.loom.com/

Okay I will try to do that later today what did you want me to show and focus on to help troubleshoot this

Jozmichne avatar Apr 13 '23 20:04 Jozmichne

I'm encountering same issue. Same error and the stripe app does not offer a button to set the keys. It's only an on/off toggle.

I've set all the env vars, but it still does not work.

vsviridov avatar Jun 10 '23 07:06 vsviridov

I'm also experiencing the same error. cal.com actual version self-hosted with docker. thanks

wokawoka avatar Jun 10 '23 16:06 wokawoka

Was able to bypass it by launching yarn db-studio, going to the App table, finding the stripe slug and populating the keys column with a valid JSON object of the following form:

{
  "client_id": "ca_...",
  "public_key": "pk_test_...",
  "client_secret": "sk_test_...",
  "webhook_secret": "whsec_...",
  "payment_fee_fixed": 0,
  "payment_fee_percentage": 0
}

vsviridov avatar Jun 10 '23 16:06 vsviridov

Now I'm getting Webhook Error: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe? and the payment status is stuck at Pending.

vsviridov avatar Jun 10 '23 17:06 vsviridov

Okay, I've updated the env var for the webhook_secret, and now incoming webhook payloads are validated, but now I'm getting the Incoming Connected Account error, which doesn't mean much. I'm running test credentials though, not sure if that would affect it.

vsviridov avatar Jun 10 '23 18:06 vsviridov

But aren't payments an exclusive feature of the enterprise version? I still need to figure out if it is possible to make stripe payments work in the community docker version.

wokawoka avatar Jun 12 '23 09:06 wokawoka

After following an unrelated set up for Google Calendars, I ran the

cd packages/prisma
yarn seed-app-store

commands and now Stripe button in my local app-store has the Keys button, where as before it did not...

image

vsviridov avatar Jun 12 '23 14:06 vsviridov

~~I think there's a bug in the packages/features/apps/AdminAppsList.tsx on the line 104. Currently it reads "When there are application keys open the keys dialog, otherwise just toggle". I think the code meant - When you toggle and there aren't application keys - show keys dialog, but if the keys are there - just enable the app. Elsewhere in the same component it only shows the edit button if the keys are set...~~

vsviridov avatar Jun 12 '23 15:06 vsviridov

~~Okay, the problem is that the editor window is not visible if the Db record is empty, but we can derive the necessary keys from the zod validation schema... I'm playing with my deployed version currently on a very small VPS, so recompiling takes 10 minutes and running in dev is like pulling teeth, because each pages takes a minute to render... I might try loading up code on a beefier machine and see if I can come up with something.~~

vsviridov avatar Jun 12 '23 21:06 vsviridov

Okay, the actual problem for Stripe specifically, is that the appKeysSchemas lists the schema for it under stripe key, but the app is using the stripe-payment slug, so packages\trpc\server\routers\viewer\apps\listLocal.handler.ts cannot create default keys for it, and the key edit button does not show up.

vsviridov avatar Jun 14 '23 04:06 vsviridov