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

[Doc] Stripe Module Provider page should mention what webhook events are needed. #10608

Closed
2 tasks done
SneakySensei opened this issue Dec 14, 2024 · 0 comments · Fixed by #10618
Closed
2 tasks done
Assignees

Comments

@SneakySensei
Copy link

What Medusa version and documentation are you using?

v2

Preliminary Checks

Issue Summary

https://docs.medusajs.com/resources/commerce-modules/payment/payment-provider/stripe
This page mentions that we need to create a webhook in Stripe dashboard but it doesn't mention which events are needed.

I had to look at the source to figure this out:

switch (event.type) {
case "payment_intent.amount_capturable_updated":
return {
action: PaymentActions.AUTHORIZED,
data: {
session_id: intent.metadata.session_id,
amount: getAmountFromSmallestUnit(
intent.amount_capturable,
currency
), // NOTE: revisit when implementing multicapture
},
}
case "payment_intent.succeeded":
return {
action: PaymentActions.SUCCESSFUL,
data: {
session_id: intent.metadata.session_id,
amount: getAmountFromSmallestUnit(intent.amount_received, currency),
},
}
case "payment_intent.payment_failed":
return {
action: PaymentActions.FAILED,
data: {
session_id: intent.metadata.session_id,
amount: getAmountFromSmallestUnit(intent.amount, currency),
},
}
default:
return { action: PaymentActions.NOT_SUPPORTED }
}
}

Events that Medusajs depends upon are:

  1. payment_intent.amount_capturable_updated
  2. payment_intent.succeeded
  3. payment_intent.payment_failed

How can this issue be resolved?

Add the required event types to the doc.

Are you interested in working on this issue?

  • I would like to fix this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants