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

bug: PriceId can be prefixed with either price_ or plan_ but only price_ is currently valid #470

Closed
skeptrunedev opened this issue Jan 10, 2024 · 1 comment · Fixed by #471
Labels
bug Something isn't working

Comments

@skeptrunedev
Copy link

Describe the bug

I was trying to receive a Subscription and could not due to a error serializing or deserializing a request error.

Above where I was getting that error, there was a log saying bad id is: plan_************** (expected: "price_") for PriceId which clued to me into what was likely happening.

From there, I used the CLI to retrieve the sub stripe subscriptions retrieve sub_******************** so I could validate that there was a plan_ value for a price.

Sure enough in the items for the sub, there was:

"price": {
          "id": "plan_**************",
          "object": "price",
          "active": true,
          "billing_scheme": "per_unit",
          "created": 1704826754,
          "currency": "usd",
          "custom_unit_amount": null,
          "livemode": false,
          "lookup_key": null,
          "metadata": {},
          "nickname": null,
          "product": "prod_**************",
          "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": 1200,
          "unit_amount_decimal": "1200"
        },
        "quantity": 1,
        "subscription": "sub_********************",
        "tax_rates": []
      }
    ],
    "has_more": false,
    "total_count": 1,
    "url": "/v1/subscription_items?subscription=sub_********************"
  },

### To Reproduce

1. create a price that is a plan
2. create a subscription for that price
3. retrieve that subscription with `stripe::Subscription::retrieve`

### Expected behavior

I expect that the result of retrieving the subscription can be deserialized. 

### Code snippets

_No response_

### OS

ubuntu 22.04

### Rust version

1.76.0-nightly

### Library version

async-stripe 0.26.0

### API version

2023-10-16

### Additional context

_No response_
@skeptrunedev skeptrunedev added the bug Something isn't working label Jan 10, 2024
@arlyon
Copy link
Owner

arlyon commented Jan 10, 2024

Looks like we are missing the prefix for this id. Easy fix, I'll have a PR up in a few

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants