#brel_api
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1392558123276963912
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- brel_api, 2 days ago, 82 messages
- brel_api, 2 days ago, 14 messages
- brel_unexpected, 6 days ago, 69 messages
I don't understand what that error means and why I cannot update it
Where did you see that error?
API response
I don't see a request associated with that object with that error. Can you provide more details on it? Do you log the whole error, or the Request ID?
I am using Rails Stripe SDK and I am calling like this:
Stripe::PromotionCode.update("promo_1Rj1RPARjJ1na9ElnnhU3Zu6", {"restrictions"=>{"currency_options"=>{"usd"=>{"minimum_amount"=>1500}}}})
just try to update the promo_1Rj1RPARjJ1na9ElnnhU3Zu6
you'll see the error
What is "Rails Stripe SDK"? You mean the Ruby Stripe SDK?
yes
but doesnt matter
you can try with wahtever tool
curl, api or other
you'll se the error
just try to update the promo code
Where did you get the shape of that object from?
if that's not correct please tell me
how can I call
Since Stripe message did not say anything about the structure I thought the problem was somewher elese
If not a problem for you can you send me how it should be called?
Where did you get it?
From Stripe docs
It's fine. The docs are here: https://docs.stripe.com/api/promotion_codes/object#promotion_code_object-restrictions
Is it possible for you to not just ask me question but help how can I update it
Wait, which Stripe doc?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Damn.
Ok, sorry. I see that now. This is possibly a bug on our end, let me confirm/refute.
ok, let me know please
Can you please reproduce this in a way that you can capture the Request ID and complete error from the Stripe API?
Without actually seeing the error in our systems I can't dig into this.
Just give me a second please.
ok
Can I have a response if that was expected or a bug on your end?
Should I wait for that to get fixed?
I'm currently helping multiple folks simultaneously so once I'm able to fully dig into this and understand the cause, I will let you know.
That promo code has never had that error. Other promo codes have.
That promo code has never had that error. Other promo codes have.
What do you mean by this?
The code you gave me has never been used in a request that failed with that error.
I am facing also another issue:
applies_to is not returned in retrieve coupon. How can I get the list of all products a coupon is applied to?
That field exists on the object but is is not returned when I retrieve a coupon. Can you please double check?
Hey brel, taking over for my colleague here. Getting caught up one moment.
Hi hi. I was able to reproduce the initial issue, and I'm currently investigating further, but mossy can help with your most recent question.
Yes please @terse mortar
I'm seeing the same that you've described doesn't seem to be exandable. Testing if this is the same for coupons created via api
Looks like it's expandable.
How are you calling it?
So if you retrieve the coupon with expansion on the 'applies_to' field it will display
retrieved_coupon = Stripe::Coupon.retrieve({expand: ['applies_to'], id: coupon.id})
We usually do a better job of indicating what fields are expandable in our API doc, I'll see if I can have that improved.
I tried the same and it didn’t work
can you please send me how the response looks like?
👋 stepping in. When you retrieve the Coupon you need to expand applies_to for that hash to be included in the response.
See: https://stripe.com/docs/expand if you aren't familiar with exansion
I am familiar with it but It does not work for me with expand
I am using Ruby sdk
how should I call it
Can you share your exact code snippet and the Coupon ID you are retrieving?
Should just look like:
Stripe::Coupon.retrieve({
id: 'replace_with_your_coupon_id',
expand: ['applies_to'],
})
Thank you @wind vigil
I have another thing that I need around coupons
I need the redemption history by customers that used that promo code
how can I get that list
similar to how it is shown on Stripe dashboard
The API doesn't return that information -- you would have to track that on your end.
How can I get that information?
You mean by saving on my app every time the code is applied?
Isnt any way from Stripe to provide that?
You can list out Subscriptions to see if a discount is applied and then expand the promotion code related to the Discount.
But no, the API doesn't provide that information directly.
You have to aggregate it or track it in your own database (either upon application or using Webhooks).
Stripe::Coupon.retrieve({
id: 'replace_with_your_coupon_id',
expand: ['applies_to'],
})
On this one can I further expand the products inside. I want to know the product name
Does stripe allow to expand nested fields?
Yes but I don't believe that is supported in this case.
You can try applies_to.products but pretty sure you have to retrieve the Products here in a separate request if you want that info.
Yeah that's not supported here
So you do have to make separate requests for the Products themselves.
Got it
ok thank you
And regarding the problem I mentioned at the beginning of the thread there?
Any response if there is an issue on your end
I did not got a final response on that
by your colleague
I see that in Stripe dashboard a promo code amount is not possible to be updated
Ah I missed that initial question.
So I gues even from apis
Can you share the request ID related to that error?
but on the doc it is present
I dont have a requst ID
but I tried several times
on every promo code is the same error
It would be in the response headers
You can try to update one
I think is not possible to update promo code or cupon amount
At least on stripe dashboard it is not possible
So probably it isnt prossible to be done by api as well
I believe you can update the minimm amount
But no you can't update the amount itself
What are you trying to do?
yes, but on docs it says it is possible
and amount can be changed
I was checking update promo code
API
Which docs?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
This one
Where does it show you can update amount there?
You can update the minimum_amount which I stated above
Which is the required amount of the purchase in order for the Promo code to be able to be applied.
But this doesn't change the actual Promo Code's amount
That amount is directly tied to the associated Coupon
Yes, sorry. I was referring to minimum amount. As you see at the beginning of my message is what I passed and I got this error:
Stripe error: You are specifying a currency option that matches the top-level currency for this promotion code. Please remove this currency option and it will be added automatically on creation.",
The error came from Stripe