#GastonLifschitz

1 messages · Page 1 of 1 (latest)

quasi latchBOT
gentle kestrel
#

Hello 👋
My understanding was that we did support expand on all API endpoints.
What are you seeing in the response? Also can you share the code?

latent shoal
#

Yes of course

#
try {
      return (
        await stripe.subscriptions.search({
          query: `status:'canceled' AND metadata['deviceId']:'${mac}' AND metadata['userId']:'${userId}'`,
          expand: ['default_payment_method'],
        })
      )?.data[0]
    } catch (err) {
      logger.warn(`Stripe error: ${err.message || err}`)
      return
    }
#

That's my code

#

without expand it works fine

#

Otherwise, it returns null

gentle kestrel
#

Have you tried expanding data.default_payment_method?

latent shoal
#

I haven't, give me one sec and I'll try it out

#

That did the trick, any idea why subscriptions.retrieve i can use default_payment_method and in subscriptions.search I should use data.default_payment_method?