#bilalahmer

1 messages · Page 1 of 1 (latest)

quartz tuskBOT
tulip jackal
#

Hi! Let me help you with this.

#

Could you please share the frontend code related to this?

harsh pivot
#

Hi, Yeah sure.

#

initStripe() { const options = { clientSecret: this.intent, automatic_payment_methods: { enabled: true, }, appearance: {/*...*/}, }; this.elements = this.stripe.elements(options); const paymentElement = this.elements.create('payment'); paymentElement.mount('#payment-element'); },

async setCreditCard(e) { e.preventDefault(); const {error} = await this.stripe.confirmSetup({ //Elementsinstance that was used to create the Payment Element elements: this.elements, redirect: 'if_required', confirmParams: { } }); const messageContainer = document.querySelector('#error-message'); if (error) { messageContainer.textContent = error.message; } else { messageContainer.textContent = 'Payment method successfully added.' } },

tulip jackal
#

Is this a card Setup?

harsh pivot
#

Yes.

#

So from here I'm not sure how to pass the correct amount on the popup page(snap shared above) ?
Do we have a separate api for that or I'm missing something ?

tulip jackal
#

If it's a Setup there's no amount, so it's expected. With SetupIntent you are saving the payment method info to be used for later charges. But at the moment of collection there's nothing to pay, therefore there's no amount.

harsh pivot
#

Yes it is with SetupIntent .
Stripe::SetupIntent.create({customer: current_user.stripe_id})
So do i need to pass something here ☝️ ?

tulip jackal
#

You can't set an amount on SetupIntent.

harsh pivot
#

So were can i set it ? To show it on the popup

tulip jackal
#

"show it", what do you mean by "it" in this context?

harsh pivot
#

amount*

tulip jackal
harsh pivot
#

In the picture I shared above it shows 0 total right ?
All I'm asking how can I change it ? I want to show there my order total price.

tulip jackal
#

You can't because it's a card setup. It will always be $0.

harsh pivot
#

So what do you recommend how can I achieve it ?

tulip jackal
#

Please, let me know if you have any other questions.

harsh pivot
#

I'm having a look will let you in few minutes, thank you.