#KRS
1 messages · Page 1 of 1 (latest)
Hi there, you can listen to invoice.created event, and create a invoice item with negative amount (https://stripe.com/docs/api/invoiceitems/create?lang=java#create_invoiceitem-amount) for this invoice.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Is there any way that i can do it in the create subscription flow? Our current steps are
- Create customer
- Create subscription with required price ids
- Check if invoice is paid, if not paid, then pay it
- Create subscription reference in our system after successful invoice paid
all these steps happen in a single API, is it possible to introduced this new item at step 3, before we pay?
what i understand is that at the step (3) the invoice status is open, which cannot be modified
That's why I suggest you to listen to invoice.created event, the invoice is still in draft mode, and you can still update it.
invoice.created https://connect.stripe.com/test/events/evt_1MRr67IvwrjYDHRM1VNhRPDi
invoice.finalized https://connect.stripe.com/test/events/evt_1MRr68IvwrjYDHRMiEecwlHN
both event occured at the same time
1/18/23, 11:55:39 PM
Oh, that's the first invoice that was generated when the subscription is created.
yes,
OK for the first invoice you can use add_inovice_items param (https://stripe.com/docs/api/subscriptions/create?lang=node#create_subscription-add_invoice_items) to add additional invoice items when creating a subscription.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
but that is not accepting negative amounts
A positive integer in cents (or 0 for a free price) representing how much to charge.
I tried this approach - create an invoice item before creating the subscription associated with customer having negative amount. And then create a subscription, which included the previously created invoice item in to the first invoice. Is this approach valid? Can i use it?
Yes, this is definitely a solution. You've found an answer by yourself!
ok. thanks.
If you still around, i have another question regarding one off transfer from connected account to platform account. I see there are 2 options - Transfers and Charges. Any specific differences between them?
Are you talking about separate charges and transfers https://stripe.com/docs/connect/charges-transfers?
I want to understand the difference between stripe.Transfer.create and stripe.Charge.create
Can you share with me the doc that you are following?
My requirement it i want to take money from the connect account to platform account on certain scenarios
OK. then you should use the account debit (i.e., the charges API)
The transfers API is to transfer funds from platform to connected account
ok, got it. thanks.