invertase / stripe-firebase-extensions

Repository of Firebase Extensions built by Stripe.
https://firebase.google.com/products/extensions
Apache License 2.0
435 stars 164 forks source link

invoice.upcoming failed: Value for argument "documentPath" is not a valid resource path. Path must be a non-empty string. #616

Open joelc0193 opened 6 months ago

joelc0193 commented 6 months ago

Bug report

firestore-stripe-payments

Describe the bug

This was the error:

Stripe event of type [invoice.upcoming] failed: Value for argument "documentPath" is not a valid resource path. Path must be a non-empty string."

This is the request:

{
  "id": ["evt_1OuHWvGLpWnCiB3YultsM9NG"](https://dashboard.stripe.com/events/evt_1OuHWvGLpWnCiB3YultsM9NG),
  "object": "event",
  "api_version": "2022-11-15",
  "created": 1710435201,
  "data": {
    "object": {
      "object": "invoice",
      "account_country": "US",
      "account_name": "Poster Fans LLC",
      "account_tax_ids": null,
      "amount_due": 1000,
      "amount_paid": 0,
      "amount_remaining": 1000,
      "amount_shipping": 0,
      "application": null,
      "application_fee_amount": null,
      "attempt_count": 0,
      "attempted": false,
      "automatic_tax": {
        "enabled": false,
        "liability": null,
        "status": null
      },
      "billing_reason": "upcoming",
      "charge": null,
      "collection_method": "charge_automatically",
      "created": 1711039978,
      "currency": "usd",
      "custom_fields": null,
      "customer": ["cus_PPWc0hdWkEmlzD"](https://dashboard.stripe.com/customers/cus_PPWc0hdWkEmlzD),
      "customer_address": null,
      "customer_email": "info@managedmusic.com",
      "customer_name": null,
      "customer_phone": null,
      "customer_shipping": null,
      "customer_tax_exempt": "none",
      "customer_tax_ids": [
      ],
      "default_payment_method": null,
      "default_source": null,
      "default_tax_rates": [
      ],
      "description": null,
      "discount": null,
      "discounts": [
      ],
      "due_date": null,
      "effective_at": null,
      "ending_balance": 0,
      "footer": null,
      "from_invoice": null,
      "issuer": {
        "type": "self"
      },
      "last_finalization_error": null,
      "latest_revision": null,
      "lines": {
        "object": "list",
        "data": [
          {
            "id": ["il_tmp_125151GLpWnCiB3Y1403fe62"](https://dashboard.stripe.com/subscriptions/il_tmp_125151GLpWnCiB3Y1403fe62),
            "object": "line_item",
            "amount": 1000,
            "amount_excluding_tax": 1000,
            "currency": "usd",
            "description": "1 × Dealer Membership (at $10.00 / month)",
            "discount_amounts": [
            ],
            "discountable": true,
            "discounts": [
            ],
            "invoice": null,
            "livemode": true,
            "metadata": {
            },
            "period": {
              "end": 1713718378,
              "start": 1711039978
            },
            "plan": {
              "id": ["price_1OFdYZGLpWnCiB3YAWTsq1R6"](https://dashboard.stripe.com/prices/price_1OFdYZGLpWnCiB3YAWTsq1R6),
              "object": "plan",
              "active": true,
              "aggregate_usage": null,
              "amount": 1000,
              "amount_decimal": "1000",
              "billing_scheme": "per_unit",
              "created": 1700748423,
              "currency": "usd",
              "interval": "month",
              "interval_count": 1,
              "livemode": true,
              "metadata": {
              },
              "nickname": null,
              "product": ["prod_P3l46ip1uGjUaM"](https://dashboard.stripe.com/products/prod_P3l46ip1uGjUaM),
              "tiers_mode": null,
              "transform_usage": null,
              "trial_period_days": null,
              "usage_type": "licensed"
            },
            "price": {
              "id": ["price_1OFdYZGLpWnCiB3YAWTsq1R6"](https://dashboard.stripe.com/prices/price_1OFdYZGLpWnCiB3YAWTsq1R6),
              "object": "price",
              "active": true,
              "billing_scheme": "per_unit",
              "created": 1700748423,
              "currency": "usd",
              "custom_unit_amount": null,
              "livemode": true,
              "lookup_key": null,
              "metadata": {
              },
              "nickname": null,
              "product": ["prod_P3l46ip1uGjUaM"](https://dashboard.stripe.com/products/prod_P3l46ip1uGjUaM),
              "recurring": {
                "aggregate_usage": null,
                "interval": "month",
                "interval_count": 1,
                "trial_period_days": null,
                "usage_type": "licensed"
              },
              "tax_behavior": "unspecified",
              "tiers_mode": null,
              "transform_quantity": null,
              "type": "recurring",
              "unit_amount": 1000,
              "unit_amount_decimal": "1000"
            },
            "proration": false,
            "proration_details": {
              "credited_items": null
            },
            "quantity": 1,
            "subscription": ["sub_1Ob4GUGLpWnCiB3YyYFwnBqd"](https://dashboard.stripe.com/subscriptions/sub_1Ob4GUGLpWnCiB3YyYFwnBqd),
            "subscription_item": "si_PPu4h18lzBJHnq",
            "tax_amounts": [
            ],
            "tax_rates": [
            ],
            "type": "subscription",
            "unit_amount_excluding_tax": "1000"
          }
        ],
        "has_more": false,
        "total_count": 1,
        "url": "/v1/invoices/upcoming/lines?customer=cus_PPWc0hdWkEmlzD&subscription=sub_1Ob4GUGLpWnCiB3YyYFwnBqd"
      },
      "livemode": true,
      "metadata": {
      },
      "next_payment_attempt": 1711043578,
      "number": null,
      "on_behalf_of": null,
      "paid": false,
      "paid_out_of_band": false,
      "payment_intent": null,
      "payment_settings": {
        "default_mandate": null,
        "payment_method_options": null,
        "payment_method_types": null
      },
      "period_end": 1711039978,
      "period_start": 1708534378,
      "post_payment_credit_notes_amount": 0,
      "pre_payment_credit_notes_amount": 0,
      "quote": null,
      "receipt_number": null,
      "rendering": null,
      "rendering_options": null,
      "shipping_cost": null,
      "shipping_details": null,
      "starting_balance": 0,
      "statement_descriptor": null,
      "status": "draft",
      "status_transitions": {
        "finalized_at": null,
        "marked_uncollectible_at": null,
        "paid_at": null,
        "voided_at": null
      },
      "subscription": ["sub_1Ob4GUGLpWnCiB3YyYFwnBqd"](https://dashboard.stripe.com/subscriptions/sub_1Ob4GUGLpWnCiB3YyYFwnBqd),
      "subscription_details": {
        "metadata": {
        }
      },
      "subtotal": 1000,
      "subtotal_excluding_tax": 1000,
      "tax": null,
      "test_clock": null,
      "total": 1000,
      "total_discount_amounts": [
      ],
      "total_excluding_tax": 1000,
      "total_tax_amounts": [
      ],
      "transfer_data": null,
      "webhooks_delivered_at": null
    }
  },
  "livemode": true,
  "pending_webhooks": 1,
  "request": {
    "id": null,
    "idempotency_key": null
  },
  "type": "invoice.upcoming"
}

## To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

1. Go to '…'
2. Click on '…'
3. Scroll down to '…'
4. See error

## Expected behavior

A clear and concise description of what you expected to happen.

## Screenshots

If applicable, add screenshots to help explain your problem.

## System information

- OS: [e.g. macOS, Windows]
- Browser (if applies) [e.g. Chrome, Safari]

## Additional context

Add any other context about the problem here.
aar-stripe commented 6 months ago

The problem is basically related to the fact that upcoming invoices don't have an id nor a payment intent which either is used as the record ID (code). This is the same behavior as the retrieve an upcoming invoice functionality.

jsteele-stripe commented 6 months ago

cc @dackers86

hasan-abul commented 5 months ago

@aar-stripe By default stripe don't have an id or payment intent for invoice.upcoming event.

Do we have a solution here? Thanks

aar-stripe commented 5 months ago

unfortunately until the maintainers fix the issue you can't really do much.

SohelIslamImran commented 2 months ago

Same issue