#arielbo-hello

1 messages · Page 1 of 1 (latest)

ember flax
hexed herald
#

I give you more context, when I create one subscription with:

                                    'customer' => $json_obj->cus, 
                                    'default_payment_method' => $cus_default_payment_method, 
                                    'items' => [
                                      [
                                  ````
#

ID
req_MrFXlZtdTZVzCS

#

in every subscription stripe create one payment method, how can I avoid this please if you can help me, i will be very happy

ember flax
#

Do you have the IDs for the payment methods that are duplicates?

#

That call did not duplicate the PaymentMethod that you gave it. The same PaymentMethod with the same ID is being used for that subscription pm_1Jrp0WHHulAmiNnDZ0SJv2C7

hexed herald
#

of course

hexed herald
ember flax
hexed herald
#

well

#

So if I use the parameter 'default_payment_method' => pm_1Jrp0WHHulAmiNnDZ0SJv2C7, shouldn't I create another input to insert card data again?

ember flax
#

What do you mean there?

#

What you did will work and will use a preexisting payment method on the subscription without creating a new one

hexed herald
#

Let me explain myself better, as I understand you, duplicate payment methods are being created because I am asking the client to enter their card details (number, expiration date, etc.) even though I have predefined the payment method in the object subscription at the time of creation, as the client re-inserts their payment data then the 2nd payment method is generated. this is so correct?

#

So, I ask you if using the parameter 'default_payment_method' => pm_1Jrp0WHHulAmiNnDZ0SJv2C7 when I create the subscription the payment will be made automatically, using this payment method? ex. using a direct payment button with the default payment method, and thus the customer would no longer have to re-enter their card details.

#

and I back to my original question how can I avoid duplicate the payment method ?

#

?

ember flax
#

Apologies, got a bit busy. Catching up again

hexed herald
#

ok please

#

pompey I m a little lost with this issue,

ember flax
#

So you can either detect that they already have a payment method and allow them to use that.

hexed herald
#

it would be easier

#

how can I do this?

ember flax
#

Wait a moment

hexed herald
#

I know how get the default payment method no problem with this

#

I use this form, maybe I would be change this input by one button that use the default payment method ? more easy

ember flax
#

Why are they entering their details details again even if they have a method defined for that subscription?

hexed herald
#

😩

#

if you guide me a little I try to develop, please

night flint
#

Hello! So, to clarify, are you showing the Card Element to the people who already have an existing Payment Method?

hexed herald
#

yes

night flint
#

If you show them that form, turn those card details into a Payment Method, and attach it to the Customer that's the source of your duplicate Payment Methods.

#

If you don't want that to happen you should write code to not show the Card Element to people who already have an existing Payment Method and let them know their card on file will be used (and probably give them the option to switch to a new card if they want).

hexed herald
#

ok... give a few minutes and I can validate if there is a default payment method and hide the form and instead show a button, but now what do I do with the button, how do I confirm a payment in a subscription?

night flint
#

Or use the one below that (Confirm a card payment with an attached PaymentMethod) where you don't even pass in a Payment Method if there's already one associated with it.

hexed herald
#

Ready, I have moved on here, I already have the button with the payment method ID by default of the customer

hexed herald
night flint
#

Try implementing the first option above, the one the link points to, as you already have the Payment Method ID client-side.

hexed herald
#

How can I generate the client secret of the Subscription's Invoice's Payment Intent? I think that is where I am lost, so far the only thing I have is the id of the client's payment method.

That is, when the customer clicks the pay button with his default method, what would the stripe code follow to confirm the payment? I would have to create

$ stripe-> subscriptions-> create ([
'customer' => 'cus_KWuNen1R16PDr6',
'default_payment_method' => pm_1Jrp0WHHulAmiNnDZ0SJv2C7 '.....

.... something else or something before ...?

night flint
#

When you create the Subscription it will generate an Invoice, and that Invoice will generate a Payment Intent.

night flint
#

The Subscription will have a latest_invoice property pointing to the Invoice, and the Invoice will have a payment_intent property pointing to the Payment Intent, and the Payment Intent will have a client_secret property

hexed herald
#

I read again, I understand that the first method that you advice me, using js like :
stripe
.confirmCardPayment('{PAYMENT_INTENT_CLIENT_SECRET}', {
payment_method: '{PAYMENT_METHOD_ID}',
})
.then(function(result) {
// Handle result.error or result.paymentIntent
});

night flint
#

Yep.

hexed herald
#

I am thinking that my validation job would have to be in the correct js? because under the current method in which I asked the client to put his card data again I already generate the client's secret and I can use that, maybe I should only hide in my js the part in which the numbers of the card are requested card?

night flint
#

Sorry, I'm not sure I understand. Can you tell me what you mean by "already generate the client's secret"? What are you doing to generate that exactly?

hexed herald
#

I explain me better

#

please to understand me coud you check my JS please, and tell me in which place can I put the new code with .confirmCardPayment('{PAYMENT_INTENT_CLIENT_SECRET}', {
payment_method: '{PAYMENT_METHOD_ID}', .... in the case that I have payment method

night flint
#

It's not that simple, and I can't write code for you. I'm happy to help you if you're stuck and have specific questions though. What specific piece are you struggling with?

hexed herald
#

my js is here I think that I only need to validate if exist or not pm in js right ?

hexed herald
#

this is the part of that I need to change right?

night flint
#

I'm not sure. Have you tried it?

hexed herald
#

i want to try it please could i check this id
req_XaSyj0IDt7g8GJ and tell me if the generation of the default_payment_method and the secret payment intent is correct?

night flint
#

Yep, that looks correct. Now you take the client_secret in that response, send it back to the client, and call stripe.confirmCardPayment and pass in that client secret. No need to specify the Payment Method since you already did when you created the Subscription.

hexed herald
#

thanks, I have problems with js and how can I hidden this ->

night flint
#

What is "this"?

hexed herald
#

how can I hide this in js to show only the button to confirm the payment

night flint
#

Your code is displaying that, right? In the case where you don't want it displayed don't run that code.

hexed herald
#

I don't know what code generates that in js 😦

night flint
#

Did you inherit this code from someone else? Like did you take over a project from another developer?

hexed herald
#

this is your example publish in your site

night flint
#

That code is only designed to be an example of how our APIs work, not something you use in production. If you want to use it as a starting point and modify it you would need to read through all of the code and make sure you understand how all of it works first.

hexed herald
#

yes I do

#

please could you tell me how can I learn more about

#

stripe
.confirmCardPayment(clientSecret, {
payment_method: pm,
})

night flint
#

Sorry, I think I'm confused or missing something. You just said this:

I don't know what code generates that in js
But you also said you do understand the code?

hexed herald
#

I understand that in this place are that I need to understand better to work with my code

night flint
#

Is that what you need, or are you looking for something else?

hexed herald
#

maybe some about how to use and create elements like that I need to hide

night flint
#

It's not about hiding them, it's about not displaying them in the first place.

hexed herald
#

I see that in my code have: var card = elements.create("card", { style: style }); // Stripe injects an iframe into the DOM card.mount("#card-element");

night flint
#

If you don't want to display them then don't display them.

#

Yeah, don't do that if you don't want the Card Element on the page.

hexed herald
night flint
#

I don't understand. Are you asking me something or telling me what you're going to do?

hexed herald
#

What sometimes I do not understand about your support is how if you know the fastest way, you do not tell us that way, it would save more time, I make a huge effort to understand your codes but you are the experts and I am here to learn but I beg you to be more proactive to show me the way better then I will write as I can but I will.

night flint
#

I'm happy to answer any questions you have, but I don't know what you mean by "the fastest way". Is there something specific you think I haven't told you?

hexed herald
night flint
#

I want to help you, and I'm happy to hear how I could be doing that better if you have feedback.

#

You just pasted the JavaScript code that mounts the Card Element to the specified HTML element on the page.

#

There's also the HTML itself that the JavaScript specifies as the mount point.

#

In this case the HTML element with the id of card-element.

hexed herald
night flint
#

If you don't want those on the page you should modify the code to not have that HTML element and not mount anything to it.

#

I think the cause of a lot of your issues is that you're taking sample code designed to be an example of how to do one thing and trying to modify it to do something entirely different without fully understanding how the code works. I think you would have a better experience if you wrote your own code instead of trying to make existing code do something it wasn't written to do.

#

The feature of showing a customer their saved Payment Method and letting them pay with that is not something the sample code you're using does.

hexed herald
#

let try really its not easy understand sorry for my frustration

night flint
#

If you want to add that functionality you need to make a lot of modifications.

hexed herald
#

with your help I do this work like others that was be very dificult, I want to do this too

hexed herald
#

do you know some document about stripe.elements ?

night flint
short parcel
#

@hexed herald While we understand you are struggling and need help, we can't be acting as a freelancer for you. We can answer specific questions and refer you to docs, we can encourage you to try things add debug log messages and try to figure things out
But we have hundreds of people a month to help here and while you are making real progress you can't just use us as a debugger

#

You really should consider hiring an experience developer/freelancer to help you build your app and mentor you to help you grow and learn.

#

I've given you that feedback more than once now and it's important that you do understand it and try to debug and read docs on your own first before pushing in repeated threads here.

hexed herald
#

Thanks for your advice, but I will try to do it, my greatest desire is to learn to develop with stripe and I understand that I have to study and understand various things, new as well as their limitations as a support, please, do not feel like a freelancer, help me as much as your chances.

hexed herald
short parcel
#

Sure, but please be considerate of my team too. When you ask a question, take the time to formulate it clearly, explain what you have tried to do, what part of the doc, the response or the error is confusing you and what you need our help with.

hexed herald
short parcel
#

I am not the boss no, but I've been working at Stripe a while and so it's easier for me to give you this feedback, which I have given you before too

hexed herald
#

In that case, I want to thank the whole team through you, it has really been very useful for me all this help they provide in this channel, and I really do not wait to finish my app, my apologies for my ignorance on how to handle your code, no We all have the same skills and I understand that if I were a super programmer like you, I would do it in 5 minutes, but entering stripe is a world that must be learned and understood, which is not easy, and your advice as well as your clarifications help a lot. .

I have explained the problem that I have quite clearly and I have asked for solution options which have also been indicated to me now in their implementation I will surely have more doubts so I ask you to help me in the limit of your contracts with stripe and its possibilities , by no means do I want you to write my code but to guide me on how to understand your js codes to speed up my understanding process.

#

I think that what it is about is to share tips that can help me as rubeus has done

short parcel
#

@hexed herald I think I've shared tips with you numerous times though. I've personally helped you debug a large part of your code, taught you how to debug, add logs, understand which part of the code is and isn't running and how to answer your own questions quickly on your own.

#

Ultimately, we are happy to help when you have clear questions. If you're still stuck, just ask away, but clearly and concisely and we'll help you

hexed herald
# short parcel <@!891817594108141578> I think I've shared tips with you numerous times though. ...

Thank you once again for your patience, do not abandon me in the end, I have applied all the tips and they have worked (without the need for a freelancer because I want to learn, I wish there was a stripe university), and at this point I need to learn stripe elements which I have already been doing for 30 min. and I am sure with this I will be able to create the famous single button of payment with the card saved by default of the client, so that the cards are not duplicated in the client's profile.

short parcel
#

So what's blocking you?

hexed herald
#

in this point I tell yours that I manage good this https://stripe.com/docs/api and now I learn this https://stripe.com/docs/js I study more quickly until this time I understand all but I m sure that I m not understand something early ... please give a few minutes more

hexed herald
#

yey works ! I can't say, I get it 100% but I managed to make it work, I have some understanding questions that I will ask you shortly, thanks for your support and guidance but don't be as hard on stripe newbies like me. (NOT DUPLICATE THE CARD AND MY USERS WILL WOULD BUT MORE EASY) Im happy

#

this is the payment with the button:
pi_3JruLsHHulAmiNnD0u7SwTPQ

valid ruin
#

Hello, Let's open another thread if you want further help. My other colleagues are offline but I will try to help if I can