-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat(medusa-payment-stripe): Enhance stripe payment to handle description and improve status resolution #1404
feat(medusa-payment-stripe): Enhance stripe payment to handle description and improve status resolution #1404
Conversation
…tion and improve status resolution
Way to go 🎉 |
…o the static config description
Fixes #1401 |
@ShivamJoker @adrien2p I actually think that this is already possible if you call:
This call would result in:
Where this method is implemented like this: // [medusa-payment-stripe/.../stripe-provider.js
async updatePaymentData(sessionData, update) {
try {
return this.stripe_.paymentIntents.update(sessionData.id, {
...update.data,
})
} catch (error) {
throw error
}
} |
@srindom if I did properly understood, the problem is that you need to create the payment intent with the description, otherwise you get an error and therefore there is nothing to update Plus from a DX point of view, having to create and then immediately update without any changes in between I dont think it is very nice nor performant 😅 it also increase the complexity when thing can be easier to do for the consumer Wdyt? https://stripe.com/docs/india-accept-international-payments#paiements-internationaux-de-services |
Ah! But still wouldn't it be easier to have a global config at least instead of updating it on cart? |
@srindom any suggestion regarding the doc I linked in my comment? |
Given that descriptions are required on payments in some countries, I would argue that adding it as a configurable prop to the plugin options is reasonable. You wrote "& other params" in the feature description @ShivamJoker - do you know of any other properties that might be worth looking into before we proceed with this one? |
I thought for other countries we may need some more params, so I thought but for now this would do the job. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change the plugin property to payment_description
to make it clear, what is actually configured?
@@ -141,6 +125,7 @@ class StripeProviderService extends PaymentService { | |||
const amount = await this.totalsService_.getTotal(cart) | |||
|
|||
const intentRequest = { | |||
description: cart?.context?.description ?? this.options?.description, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would argue, that plugin options should take precedence over cart context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure, i was thinking that if you want to set a special description depending on the provenance of the order etc if the configuration is taking precedence it means that you can't. Wdty? The description could integrate some interesting information about the context of the payment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@olivermrbl wdty?
I think yeah we can do that. |
Yeah agree 👍 ill do the changes asap |
@olivermrbl could you point me to where I should update the doc. Only if you want it to be part of the pr |
…ption is provided
@adrien2p did you test against the real Stripe API, that an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but please address comment before merging :)
…om stripe API so update accordingly
211a9ae
to
6cc66e8
Compare
…mprove status resolution (medusajs#1404)
Allow the user to either set a static description through configuration such as:
Or eventually override the static description through the cart metadata.