enupal / stripe

Allows customers sign up for recurring and one-time payments with Stripe, perfect for orders, donations, subscriptions, and events. Create simple payment forms in seconds easily without coding. For Craft CMS
https://enupal.com/craft-plugins/stripe-payments/
Other
33 stars 19 forks source link

Every payment creates a new product in Stripe #339

Open tomfischerNL opened 1 year ago

tomfischerNL commented 1 year ago

Hi @andrelopez, every time a paymentForm is submitted, in Stripe a new product is created. This is very unhandy to check statistics in Stripe about sales per product etc. Is it possible to link a paymentForm/Payment to a specific Stripe product?

Thanks in advance!

tomfischerNL commented 1 year ago

Did you understand my problem? Let me know if it is something that you can fix? :)

andrelopez commented 1 year ago

Yes, I identified the issue. I'll dig into it

andrelopez commented 1 year ago

Hi @tomfischerNL Does this happens only on subscriptions?

tomfischerNL commented 1 year ago

Hi @andrelopez, no, also to every paymentForm as well.

tomfischerNL commented 1 year ago

Hi @andrelopez, what is the cuurent status?

tomfischerNL commented 1 year ago

@andrelopez, can you please fix this?

andrelopez commented 1 year ago

Hi @tomfischerNL I apologize for the delay in responding to your message. I understand that you are looking to attach a payment form with a Product (Price). I'd be happy to assist you with that.

Stripe Payments Pro will help you to achieve this you'll first need to synchronize your product and prices. You can refer to our documentation on how to sync your product and prices for detailed instructions.

Once you have synchronized your product and prices, you can use the Checkout Twig tag to create the payment form. We have provided various examples in our documentation to guide you through the process. You can find them here.

If you have any further questions or need additional assistance, please feel free to reach out. I am happy to help!

Also, you can find a video tutorial on how to use the new Checkout twig tag starting here at 01:10:00 and ending here at 01:26:00

tomfischerNL commented 1 year ago

Hi @andrelopez, we use the Stripe Payments Pro, but not the checkout tag because we need a lot of extra data of the customer so that is why we use the form with the fields. But not synced with our products, because the plug-in created already hundreds of products.

Every time we render the {{ craft.enupalStripe.paymentForm('form', paymentOptions) }}, it creates a new product in. Stripe, but is is unnecessary, because we add the lineItems manually.

 lineItems : [
                {
                    "price": entry.stripePriceId,
                    "quantity": 2
                }
            ]

Why does it make a new product in stripe every time...

tomfischerNL commented 1 year ago

@andrelopez , did you see my comment?

andrelopez commented 1 year ago

@tomfischerNL I am looking into this now

andrelopez commented 1 year ago

@tomfischerNL could you please share your plugin and craft cms version? also if you can share the full example of your paymentOptions variable on your templates?

tomfischerNL commented 1 year ago

Hi @andrelopez,

Stripe Payments: 5.3.1 Craft version: 4.5.2

This is the code that i'm using:

       {% set paymentOptions = {
            checkoutImages: {0: entry.image is not empty ? entry.image[0].getUrl('image') },
            checkoutSuccessUrl: currentUrl ~ '/thanks?o={number}',
            checkoutCancelUrl: currentUrl ~ '?a=canceled',
            removeDefaultItem: true,
            lineItems : [
                {
                    "price": currentBook['stripePriceId'],
                    "quantity": 1
                }
            ]
        } %}

        {{ craft.enupalStripe.paymentForm('paymentFormBook', paymentOptions) }}

So nothing special. But after every payment there will be a new product in Stripe as mentioned before.

andrelopez commented 1 year ago

Hi @tomfischerNL I was unable to recreate your issue, I created a Product 2023 on Stripe with a one-time payment price, and this price_id looks correctly associated with the payment on Stripe. No new product created on my side.

Could you please send me a screenshot to see how it looks? you can use support@enupal.com if you want.

Also, what Stripe API version are you using? you can check this under the Stripe Dashboard -> Developers

Screenshot 2023-10-27 at 7 34 59 am
andrelopez commented 1 year ago

Also, are you using Stripe Checkout ?

andrelopez commented 1 year ago

Also, are you using the beforeCreateSession on a custom plugin? I remember you were trying to pass custom params a while ago here, may be worth checking any custom plugin or module. To start debugging I need to recreate the issue on my local dev

tomfischerNL commented 1 year ago

hi @andrelopez ,

I will send you an email with more info ;) Better then here on github.

tomfischerNL commented 1 year ago

Hi Andre,

No we don't use any other custom code except for the recaptcha implementation anymore. The rest is still as regular.

Maybe we can have a quick Google Meet call? Then I can show it, maybe easier to debug?

tomfischerNL commented 1 year ago

Any follow up on this?