#greggles_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/1229882257309958195
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
What are you seeing in the response?
https://dashboard.stripe.com/test/logs/req_mcifbjXzyQxq8i
error: {
message: "This property cannot be expanded (applies_to). You may want to try expanding 'data.applies_to' instead.",
request_log_url: "https://dashboard.stripe.com/test/logs/req_mcifbjXzyQxq8i?t=1713296782",
type: "invalid_request_error",
},
}```
error seems quite clear no? ๐
None of the coupons retrieved have the applies_to property.
Can you share the full response you're seeing from the API request?
That's relevant and important information, no?
Stripe\Collection Object
(
[object] => list
[data] => Array
(
[0] => Stripe\Coupon Object
(
[id] => b5LfJWRZ
[object] => coupon
[amount_off] =>
[created] => 1711660607
[currency] =>
[duration] => forever
[duration_in_months] =>
[livemode] =>
[max_redemptions] =>
[metadata] => Stripe\StripeObject Object
(
)
[name] => 100% Off Forever
[percent_off] => 100
[redeem_by] =>
[times_redeemed] => 16
[valid] => 1
)
)
[has_more] =>
[url] => /v1/coupons
This is truncated to one coupon
I'm only seeing one recent successful API request to /v1/coupons
https://dashboard.stripe.com/test/logs/req_Mbk14UBybjFPWJ
It doesn't include expand
OK so the only way to expand applies_to is to pull a coupon individually?
As far as I know, list endpoint should work too.
Can you try running
$stripe->coupons->all(['limit' => 3],['expand'=> ['data.applies_to']]);
An uncaught Exception was encountered
Type: Stripe\Exception\InvalidArgumentException
Message: Got unexpected keys in options array: expand
uh hang on
$coupons = $stripe->coupons->all(['limit' => 3,'expand'=> ['data.applies_to']]);
That worked
Ah great!
Thank you for the help!