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
-
Hello,
I'm currently working on an app that involves Stripe metered billing. While using the
create_usage_record
method 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_record
method 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_id
as the key, but Stripe v9 docs state thatsubscription_item
should be used. I updated the key accordingly.The
subscription_item
was being sent twice—once as an element of theoptions
hash and independently in the methodStripe::SubscriptionItem.create_usage_record
. According to the Stripe Docs,subscription_item
should be sent as the first element in the params, followed by a hash with the configuration:I removed the duplicated
subscription_item
from the hash, resulting in a working solution. The modifiedcreate_usage_record
method 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