#RafaCitec-webhooks

1 messages · Page 1 of 1 (latest)

languid echo
#

hi there! Are you asking if you have to listen for webhook events?

karmic crescent
#

I'm still starting with Stripe and I want to get an idea of how it works, I've read that it's best to use webhooks because they are faster and Stripe calls me when a payment is recorded (for example)

#

I have a React, I have seen that I should install stripe.js, correct?

languid echo
#

how are you integrating with Stripe? i.e. are you using Checkout or the Payment Element?

karmic crescent
#

Exactly

#

I don't know, we want to make an integration with monthly payments, type membership site, what do you recommend?

languid echo
#

generally Checkout is much easier to integrate, mostly because the UI and a lot of validations are already built in. Of course, correspondingly, you aren't able to customize a lot of things.

The Payment Element would only collect the payment method details. You would have to build almost everything else e.g. collection of email / customer name, etc, which allows you to customize almost everything else

karmic crescent
#

Could it be that the difference between "Checkout" and "Payment Elements" is that the first is on your servers and with the second we can do the whole process on our server? because it is what we want, to do everything in-house

languid echo
#

the Checkout page is hosted on Stripe servers yes. You can take a look at the Checkout Demo, and how the Payment Element looks like on the respective links i pasted previously

karmic crescent
#

(Checkout) It would look nice I suppose, but we would already redirect our clients to checkout.stripe.com or similar, to a stripe url, right?

languid echo
karmic crescent
#

ok, if we can use our domain, what advantages does Payment Element have over Checkout? because in principle we do not want anything complicated, only the monthly payment, we are more concerned about getting something fast, functional and safe

languid echo
#

The Payment Element is for users who want to be able to customize everything

karmic crescent
#

ok, is it difficult to migrate from Checkout to Payment Element ?

languid echo
#

hmmm, i would say so yes. Mainly because you would have implement a lot of things on your page when using the Payment Element, which otherwise could have been handled by Checkout

karmic crescent
#

I say this, because thinking about it, perhaps it would be a good option to choose Checkout initially now and later if we need more customization, migrate from one to another

languid echo
#

you can always try a simple POC for each, and see how much effort it would take and what additional things you would need to implement for the Payment Element

karmic crescent
#

I see, and implementing Checkout with our domain would be easier and faster, right?

languid echo
#

imo, yes, checkout would be much easier and faster

karmic crescent
#

ok, for the 2 do I have to use stripe.js or does Checkout work differently?

languid echo
karmic crescent
#

ok, I already have it clear, this, now I have to decide

#

but another question, in this process, either one or the other, do I have to create a webhook manually? or that is already managed by Stripe

languid echo
#

you should also listen for webhooks. If the user closes the window before the Checkout Session completes, it's possible the callback won't execute. Then your application wouldn't know that the payment is done

karmic crescent
#

ok I understand, I want to use webhooks, what I don't understand is how to use them...

#

and how to use them with checkout and how to use them with Elements

languid echo
karmic crescent
#

ahhh regardless of whether I use Checkout or Elements I must create the webhook, is that true?

languid echo
#

to clarify, you would listen for the webhook event, and create a webhook endpoint. Yes, whether you use Checkout or Elements, you should listen for the relevant webhook events

karmic crescent
#

Ok, so I choose a payment method Checkout or Elements for my page, for the front and create a webhook in Stripe and configure the successful payment events and so on...
and I create in my application (backend) an endpoint that receives from Stripe the confirmation of Payment received, is that correct?

languid echo
#

that's correct for a high level summary

karmic crescent
#

High level summary is enough today jeje

#

And my last question today, how do I identify the client who is paying me? at which point I send you an id_client or email_client or token and I can link your successful payment with the client

languid echo
#

when you create the Checkout Session, there're a couple of options you can use to identify the client who is paying you : the customer, customer_email, metadata or client_reference_id or id. You would have to make some kind of comparison based on a certain parameter

karmic crescent
#

ok, and I suppose that if, for example, I use email to identify each client, the webhook events in each call made to our endpoint would pass us a parameter with the client's email

#

and with that we will be able to know if it has been paid correctly, if there have been errors in the payment or if the account must be canceled due to non-payment

languid echo
#

so assuming you're listening for checkout.session.completed events - the event data would be that of a Checkout Session : https://stripe.com/docs/api/checkout/sessions/object

If you pass in an existing Customer id, then you would be able see the customer's email in customer_details.email in checkout.session.completed

"customer_creation": null,
    "customer_details": {
      "address": {
        "city": null,
        "country": null,
        "line1": null,
        "line2": null,
        "postal_code": null,
        "state": null
      },
      "email": "test+checkout@example.com",
      "name": "checkout setup prefill",
      "phone": null,
      "tax_exempt": "none",
      "tax_ids": [
      ]
    },
    "customer_email": null,
    "expires_at": 1652934297,
    "livemode": false,
#

if you don't pass in an existing Customer id, then you would be able to see the customer's email in customer_email in checkout.session.completed

karmic crescent
#

The customers are saved in Stripe?

languid echo
karmic crescent
#

Name, lastname, email, client_id and other information...

#

ok, and can not be saved?

languid echo
#

i didn't quite understand this part ca not be saved?

karmic crescent
#

customers can't be saved to Stripe? for data protection issues and such

#

I only ask for legal reasons, I don't know if saving customers in Stripe we would have to modify our privacy policies...

languid echo
#

we mostly help out with technical/API questions on this channel and can't advise you on privacy questions. You would probably need to consult with your own legal team on this.

karmic crescent
#

ok