Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LineItems cannot be passed but documentation says otherwise #353

Open
Benoit1980 opened this issue Mar 11, 2024 · 2 comments
Open

LineItems cannot be passed but documentation says otherwise #353

Benoit1980 opened this issue Mar 11, 2024 · 2 comments

Comments

@Benoit1980
Copy link

Hello,

I have just tested your package and it seems that line items cannot be passed on the one time payment Stripe checkout payment method:

 lineItems: [
                {
                    price: "price_xxxxxxxxxxxx",
                    quantity: 1,
                    invoice_item: "ii_1Nzo1ZGgdF1VjufLzD1UUn9R",
                },
            ],

I always get this error in the browser:
app.js:9885 IntegrationError: Invalid stripe.redirectToCheckout parameter: lineItems.0.invoice_item is not an accepted parameter.

Based on the Stripe documentation:

We should be able to pass the invoice_item or other parameters to the object.

Also on your website the lineitem links on this page is broken:

Thank you

image

@jofftiquez
Copy link
Member

Hello, unfortunately, what you pass in the lineItems array is beyond my control. This error seems to be an API error, meaning the the lineItems.0.invoice_item is no longer available in the latest API. It must be because the docs for vue stripe vue 2 is outdated. But you can try to pass the latest object format from the docs to the lineItems array. Let me know if it works

@Benoit1980
Copy link
Author

Thank you for the fast reply.

I was checking the latest API:
https://docs.stripe.com/api/invoices/line_item

Based on the doc, this should have worked:

 lineItems: [
                {
                    price: "price_xxxxxxxxxxxx",
                    quantity: 1,
                    invoice_item: "ii_1Nzo1ZGgdF1VjufLzD1UUn9R",
                },
            ],

This is the object of the latest API:

{
  "id": "il_tmp_1Nzo1ZGgdF1VjufLzD1UUn9R",
  "object": "line_item",
  "amount": 1000,
  "amount_excluding_tax": 1000,
  "currency": "usd",
  "description": "My First Invoice Item (created for API docs)",
  "discount_amounts": [],
  "discountable": true,
  "discounts": [],
  "invoice_item": "ii_1Nzo1ZGgdF1VjufLzD1UUn9R",  <----------Here
  "livemode": false,
  "metadata": {},
  "period": {
    "end": 1696975413,
    "start": 1696975413
  },
  "price": {
    "id": "price_1NzlYfGgdF1VjufL0cVjLJVI",
    "object": "price",
    "active": true,
    "billing_scheme": "per_unit",
    "created": 1696965933,
    "currency": "usd",
    "custom_unit_amount": null,
    "livemode": false,
    "lookup_key": null,
    "metadata": {},
    "nickname": null,
    "product": "prod_OnMHDH6VBmYlTr",
    "recurring": null,
    "tax_behavior": "unspecified",
    "tiers_mode": null,
    "transform_quantity": null,
    "type": "one_time",
    "unit_amount": 1000,
    "unit_amount_decimal": "1000"
  },
  "proration": false,
  "proration_details": {
    "credited_items": null
  },
  "quantity": 1,
  "subscription": null,
  "tax_amounts": [],
  "tax_rates": [],
  "type": "invoiceitem",
  "unit_amount_excluding_tax": "1000"
}

I also tried to pass metadata to it but it fails too(with the same error as to "lineItems.0.metadata"):

  metadata: {
    product_id: "6735"
  },

Thanks

Ben

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants