#Mahesh K

1 messages · Page 1 of 1 (latest)

tough spruceBOT
brazen dagger
#

Hi there!

buoyant igloo
#

yes

#

i am using standard type

brazen dagger
#

Go it. Then when creating an invoice on a connected account, the application_fee_amount is the amount you want the platform to recieve.

buoyant igloo
#

ok thank you.

#

then for collection method key which one should i choose

#

charge automatically or send_invoice

#

may i know the difference?

brazen dagger
buoyant igloo
#

Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions.

#

What if my customer doesn't have the default source attached?

brazen dagger
buoyant igloo
#

Ok, gotch you

#

Thank you soma

brazen dagger
#

Happy to help 🙂

buoyant igloo
#

async function createInvoice(obj, accountID, amountTotal) {

let modified_obj = {
customer: obj.p_stripe_id,
amount : amountTotal * 100,
collection_method: 'send_invoice',
currency: 'usd',
customer_email : obj.contact_email,
application_fee_amount : 500
}

let invoice = await stripe.invoices.create(modified_obj, { stripeAccount: accountID })
return invoice
}

#

will it works

#

??

brazen dagger
#

Have you tried running this code?

buoyant igloo
#

yes

#

will stripe accept this key

#

amount : amountTotal * 100,

brazen dagger
#

yes
Did it work?

#

amount : amountTotal * 100,
Depends what amountTotal is

buoyant igloo
#

yes its working for some values

#

and throwing error for float values