#greggles_api

1 messages ยท Page 1 of 1 (latest)

lapis locustBOT
#

๐Ÿ‘‹ 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.

sudden yokeBOT
smoky crown
#

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? ๐Ÿ™‚
novel cave
#

None of the coupons retrieved have the applies_to property.

smoky crown
#

Can you share the full response you're seeing from the API request?

novel cave
#

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

smoky crown
novel cave
#

OK so the only way to expand applies_to is to pull a coupon individually?

smoky crown
#

As far as I know, list endpoint should work too.

Can you try running

$stripe->coupons->all(['limit' => 3],['expand'=> ['data.applies_to']]);
novel cave
#
An uncaught Exception was encountered
Type: Stripe\Exception\InvalidArgumentException

Message: Got unexpected keys in options array: expand
smoky crown
#

uh hang on

novel cave
#

$coupons = $stripe->coupons->all(['limit' => 3,'expand'=> ['data.applies_to']]);

#

That worked

smoky crown
#

Ah great!

novel cave
#

Thank you for the help!