#rajput.abd_22

1 messages · Page 1 of 1 (latest)

vale craneBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

lone quail
#

Hi, let me help you with this.

#

I am not following, could you please elaborate?

patent iris
#

this is my first question on this topic

#

i need to confirm payment but payment is not getting confirm

lone quail
#

Could you please share the PaymentIntent ID pi_xxx?

patent iris
#

okay

#

pi_3O7bbGCz4DYWbcET0aF8d19v

lone quail
#

There's an error message, do you see it?

patent iris
#

yupp i see that but i don't have any idea how to resolve it

lone quail
#

But what are you using to collect the payment details?

patent iris
#

const paymentMethods = await stripe.paymentMethods.list( {
customer: customerId,
});

i am fetching the paymentMethods details by this

lone quail
patent iris
#

yes

vale craneBOT
patent iris
#

@raw salmon is someone there

raw salmon
#

Catching up

worldly crown
#

I'm really sorry but I don't understand what you're asking. What does "i need to confirm payment but payment is not getting confirm" mean?
is there some code you ran that is giving an error?

#

can you share the exact complete frontend code you're using?

patent iris
#

okay

#

nodejs
`module.exports.createSubscriptions = async ( data ) =>
{
try
{
const { customerId, description, items, payment_settings } = data;
const add_invoice_items = data.add_invoice_items ? { add_invoice_items: data.add_invoice_items } : {};

    return await stripe.subscriptions.create( {
        customer: customerId,
        description: description,
        items: items,
        ...add_invoice_items,
        payment_behavior: 'default_incomplete',
        payment_settings: payment_settings,
        expand: [ 'latest_invoice.payment_intent' ],
    } );
} catch ( error )
{
    throw error;
}

}`

module.exports.retrievePaymentMethod = async ( customerId, type ) => { try { const paymentMethods = await stripe.paymentMethods.list( { customer: customerId, }); const paymentMethod = paymentMethods.data[ 0 ]; return { paymentMethodId: paymentMethod.id, billing_details: paymentMethod.billing_details, card: paymentMethod.card, us_bank_account: paymentMethod.us_bank_account, type: paymentMethod.type } } catch ( error ) { throw error; } }

the above is backend code(nodejs) for creating a subscription.

`elements = { clientSecret: data.subscription.clientSecret, paymentMethodId: data.subscription.paymentMethodId }
async function confirmPaymentThroughParent ( elements ){

stripe.confirmPaymentIntent( elements.clientSecret, {
  payment_method: elements.paymentMethodId,
} ).then( function ( result ){
} );

}`

this is frontEnd code

worldly crown
#

hmm, don't use that confirmPaymentIntent function.

patent iris
#

but i have two types of payment method
card and us_bank_account