Bug fix #934
Unanswered
emiliosaidm
asked this question in
General
Bug fix
#934
Replies: 1 comment
-
|
You are correct, we should remove the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm currently working on an app that involves Stripe metered billing. While using the
create_usage_recordmethod with a specific subscription_item, I encountered an error when executingsubscription.create_usage_record(subscription_item: "si_PKj91eivwl89yw", quantity: 99):To resolve this issue, I made adjustments to the
create_usage_recordmethod in the file/path/to/your/app/lib/pay/stripe/subscription.rb. Here's what I did:The Pay gem documentation specifies using
subscription_item_idas the key, but Stripe v9 docs state thatsubscription_itemshould be used. I updated the key accordingly.The
subscription_itemwas being sent twice—once as an element of theoptionshash and independently in the methodStripe::SubscriptionItem.create_usage_record. According to the Stripe Docs,subscription_itemshould be sent as the first element in the params, followed by a hash with the configuration:I removed the duplicated
subscription_itemfrom the hash, resulting in a working solution. The modifiedcreate_usage_recordmethod looks like this:I wanted to share this information with you, and I'm open to suggestions if there's a better approach.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions