#brel_api

1 messages · Page 1 of 1 (latest)

tranquil wolfBOT
#

👋 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.

pliant ermine
#

I don't understand what that error means and why I cannot update it

alpine geyser
#

Where did you see that error?

pliant ermine
#

API response

alpine geyser
#

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?

pliant ermine
#

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

alpine geyser
#

What is "Rails Stripe SDK"? You mean the Ruby Stripe SDK?

pliant ermine
#

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

alpine geyser
#

Where did you get the shape of that object from?

pliant ermine
#

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?

alpine geyser
#

Where did you get it?

pliant ermine
#

From Stripe docs

alpine geyser
pliant ermine
#

Is it possible for you to not just ask me question but help how can I update it

alpine geyser
#

Wait, which Stripe doc?

pliant ermine
alpine geyser
#

Damn.

#

Ok, sorry. I see that now. This is possibly a bug on our end, let me confirm/refute.

pliant ermine
#

ok, let me know please

alpine geyser
#

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.

pliant ermine
#

But you told me that you saw it

#

and was possibly a bug on your end

alpine geyser
#

Just give me a second please.

pliant ermine
#

ok

#

Can I have a response if that was expected or a bug on your end?

#

Should I wait for that to get fixed?

alpine geyser
#

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.

pliant ermine
#

That promo code has never had that error. Other promo codes have.

What do you mean by this?

alpine geyser
#

The code you gave me has never been used in a request that failed with that error.

pliant ermine
#

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?

tranquil wolfBOT
terse mortar
#

Hey brel, taking over for my colleague here. Getting caught up one moment.

alpine geyser
#

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.

pliant ermine
#

Yes please @terse mortar

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.

pliant ermine
#

How are you calling it?

terse mortar
#

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.

tranquil wolfBOT
pliant ermine
#

I tried the same and it didn’t work

#

can you please send me how the response looks like?

wind vigil
#

👋 stepping in. When you retrieve the Coupon you need to expand applies_to for that hash to be included in the response.

pliant ermine
#

I am familiar with it but It does not work for me with expand

#

I am using Ruby sdk

#

how should I call it

wind vigil
#

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'],
})
tranquil wolfBOT
pliant ermine
#

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

wind vigil
#

The API doesn't return that information -- you would have to track that on your end.

pliant ermine
#

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?

wind vigil
#

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).

pliant ermine
#

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?

wind vigil
#

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.

pliant ermine
#

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

wind vigil
#

Ah I missed that initial question.

pliant ermine
#

So I gues even from apis

wind vigil
#

Can you share the request ID related to that error?

pliant ermine
#

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

wind vigil
#

It would be in the response headers

pliant ermine
#

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

wind vigil
#

I believe you can update the minimm amount

#

But no you can't update the amount itself

#

What are you trying to do?

pliant ermine
#

yes, but on docs it says it is possible

#

and amount can be changed

#

I was checking update promo code

#

API

wind vigil
#

Which docs?

pliant ermine
#

This one

wind vigil
#

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

pliant ermine
#

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

tranquil wolfBOT