#mdrifat_94613

1 messages · Page 1 of 1 (latest)

naive cairnBOT
green heath
viscid jewel
#

i want to send this amount only for test mood

#

but the link you provided, its not for test mood

green heath
#

hmm, yes it is.

viscid jewel
#

this is my code. actually i'm a fresher. so can you suggest me with my code ? . code : payment_request_confirm = async (req, res) =>{
const {paymentId} = req.body

    try {
        const payment = await withdrawRequest.findById(paymentId)
        if(payment){
            const {stripeId} = await stripeModel.findOne({
                sellerId: new ObjectId(payment.sellerId)
            })
            await stripe.charges.create({
                amount: payment.amount*100,
                currency: 'usd',
                destination: stripeId
            })

            await withdrawRequest.findByIdAndUpdate(paymentId,{status:'success'})

            res.status(200).json({payment, message: "Payment send successful"})
        }
    } catch (error) {
        console.log(error);
        res.status(500).json({message: "Internal server Error"})
    }
}
#

i changed stripe.transfers.create to stripe.charges.create

green heath
#

was there a specific guide you were reading? using stripe.charges.create like this is legacy.

green heath
#

let's step back. What are you trying to do, what is the overall goal?

viscid jewel
#

i made a multivendor e-commerce website. i'm trying to transfer some amount of money to my seller or others. now i'm on test mood and this error shows when action hit to transfer money

green heath
#

you can't "just" transfer money, since the money needs to be available as is explained in the StackOverflow answer