Open brendansimcox opened 1 year ago
Will try to look into this soon. PayPal's API has had me pulling my teeth out many times. Have you considered using PayPal through Stripe? We've used it for some time and so far has been solid.
Thanks for the response @olivermrbl we didn't realise it was possible - do you have an example of how to implement (we are also struggling to get apple pay functional at the moment) i might be missing something in my plugin configuration
options: { api_key: STRIPE_API_KEY, webhook_secret: STRIPE_WEBHOOK_SECRET, automatic_payment_methods: true, },
@olivermrbl can confirm the customer has the methods turned on via their striped dashboard
Looking at the stripe intents and the automatic_payment_method is being set to true :s
What capture_method
is on that payment intent?
authorisation
I thought it could be manual
or automatic
.
Sorry, the payment intent is authorise and the capture_method is manual
It needs to be automatic
for some payment methods in Stripe, otherwise they won't show in PaymentElement.
Set capture: true
in plugin settings.
@brendansimcox, I realise we currently don't support PayPal through Stripe. We need a dedicated service in the plugin, similar to the existing ones.
However, adding the following service to your Medusa project should allow you to work with it:
import { PaymentIntentOptions } from "medusa-payment-stripe"
import Stripe from "stripe"
import StripeBase from "medusa-payment-stripe/dist/core/stripe-base"
const STRIPE_API_KEY = process.env.STRIPE_API_KEY || "some_test_key"
class StripePayPalCheckoutService extends StripeBase {
static identifier = "stripe-paypal"
constructor(_, options) {
super(_, options)
this.stripe_ = new Stripe(STRIPE_API_KEY, {
apiVersion: "2022-11-15",
})
}
get paymentIntentOptions(): PaymentIntentOptions {
return {
payment_method_types: ["card", "paypal"],
capture_method: "manual",
}
}
}
export default StripePayPalCheckoutService
After restarting your server, you should see "stripe-paypal" as a payment provider option in your region settings.
Let me know if it works :)
I am having this same problem. for us its more like 6/20 fail. But the payment is left uncaptured and the customer see the money as on hold. the order is not in the medusa dashboard and can not be captured. We can not use paypal through stripe due to it not being offered in the US I would love to see a fix for this or even if someone know what the problem is. I would happily do the work my self I just have no clue where even to start. when its something intermittent like this I dont know the code base enough to even know where to look.
Bug report
Describe the bug
We have noticed through production testing that the the response from payment complete for paypal payments can be erratic, so far roughly 6/20 attempts have returned a cart object instead of an order object resulting in the order not being created and the user being redirected to a 404 page.
System information
Medusa version (including plugins):
Node.js version: 14.21.3 Database: Postgres Operating system: linux
Steps to reproduce the behavior
Expected behavior
Always return a complete order object
Screenshots