#marcin-price-decimal

1 messages · Page 1 of 1 (latest)

crisp dockBOT
placid dust
#

Hey @hybrid trench I'm happy to try and help further. Can I ask you to explain what is blocking you and what you tried in details? Please summarize all of this in one message

#

marcin-price-decimal

hybrid trench
#

I've switched from using price_data to just using unit_amount_decimal and right now my invoice Items are not added to the invoice and the tax is not calculated.

placid dust
#

Please, try to summarize it all in one message with all the relevant information, including exact code if needed and/or exact object ids

hybrid trench
#

so earlier when creating incoiceItem using Stripe SDK for Node.js I was setting price_data but I was unable to use negative values in unit_amount_decimal field. I was told to use unit_amount_decimal directly on the invoiceItem but after doing that my items are not included in the invoice that I create later and the tax is not calculated.

I noticed that earlier I was setting the field called product inside price_data but I don't have that field in invoiceItem. Maybe that's related but how to tackle this problem?

placid dust
#

Sorry that's still really vague unfortunate

hybrid trench
#

Earlier it was:

stripe.invoiceItems.create({
      customer: customerId,
      description: 'abc',
      price_data: {
        currency,
        product: isEuDestination ? euProductId : usProductId,
        unit_amount_decimal: amount,
        tax_behavior: 'exclusive',
      },
    })

and now its:

stripe.invoiceItems.create({
            currency,
            customer: customerId,
            tax_behavior: 'exclusive',
            quantity: product.quantity,
            unit_amount_decimal: product.price
            ),
          })
#

after I create all the items I just simply do

stripe.invoices.create({
        metadata,
        auto_advance: false,
        customer: customerId,
        automatic_tax: { enabled: true },
        default_payment_method: stripePaymentMethod,
      })
placid dust
#

Invoices don't pull InvoiceItems into them by default

hybrid trench
#

so according to documentation if I set:
pending_invoice_items_behavior = 'include'
it should pull the invoice items?

placid dust
#

yes

hybrid trench
#

Ok, I will give it a try in a second

#

Awesome, I think it worked. Thanks a lot!