Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe plugin: webhook failing on multi-channel #2290

Closed
nonlinearcom opened this issue Jul 17, 2023 · 4 comments · Fixed by #2308
Closed

Stripe plugin: webhook failing on multi-channel #2290

nonlinearcom opened this issue Jul 17, 2023 · 4 comments · Fixed by #2308
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@nonlinearcom
Copy link

nonlinearcom commented Jul 17, 2023

Hi, we have a multi-channel setup, where every channel is connected to a different Stripe accounts with a dedicated payment method.

Orders can transition to Payment settled only on one channel. When trying to pay with another user on another channel, the order remains stuck in Arranging Payment. In the Stripe dashboard it seems a problem of failing webhook, even though API keys and Webhook secrets are registered in the same way for every channel.

On the main channel the plugin can set the payment intents without problems

[StripePlugin] Stripe payment intent id pi_3NSxzoFltThU8k2X1wYxXkhH added to order N6Y2V94WXU7HMBKY

and the weebhook in the Stripe dashboard returns ok.

In the other channels however the webhook request fails, with this response.

{
  "statusCode": 400,
  "message": "USER_INPUT_ERROR: error.payment-method-not-found",
  "timestamp": "2023-07-12T08:13:37.581Z",
  "path": "/payments/stripe"
}

Could it be because different Stripe accounts webhooks are registered to the same endpoint https://api.myvendureinstance.com/payments/stripe in the server? 🤔

To Reproduce
Steps to reproduce the behavior:

  1. Install vendure + payments-plugin + stripe
  2. Create two channels
  3. Add the ralative payment methods for each channel (with two diffrent stripe accounts on each payment handler)
  4. setup the webhook on each stripe account

Expected behavior
we should receive payments on each channel/stripe account

Environment (please complete the following information):

  • @vendure/core version: 2.0.4
  • Nodejs version 18.16
  • Database postgres
@nonlinearcom nonlinearcom added the type: bug 🐛 Something isn't working label Jul 17, 2023
@asonnleitner
Copy link
Contributor

asonnleitner commented Jul 18, 2023

Have you also set up separate stripe payment methods within each of your channels? It seems that you’ve created all the stripe payment methods in a single channel, which could be causing the ‘USER_INPUT_ERROR: error.payment-method-not-found’ error message.

@lzzfnc
Copy link
Contributor

lzzfnc commented Jul 18, 2023

Every channel has is own payment method, with relative stripe handler.

@martijnvdbrug
Copy link
Collaborator

FYI: I'm looking into this issue

@martijnvdbrug
Copy link
Collaborator

I haven't had time to add e2e tests and a fix yet, but I think the problem is on this line, where all payment methods are fetched, and we get the first one which has a Stripe handler configured.

The issue is that it fetches all payment methods, not the payment methods for the given ctx.channel. So in some channels it works, because it accidentally gets the right payment method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants