chargebee / chargebee-node

Node.js library for the Chargebee API.
https://apidocs.chargebee.com/docs/api?lang=node
MIT License
48 stars 30 forks source link

Filtering subscriptions by custom fields #19

Closed anderslyman closed 3 years ago

anderslyman commented 4 years ago

When using the .list() function, how do I specify a custom field to search by?

Naive approach (does not filter subscriptions):

  chargebee.subscription
      .list({
        limit: 2,
        plan_id: {in: ['my-app', 'my-app-(premium)']}
        cf_custom_field: { is: customValue }
      })
      .request((error, result) => {
        if (error) {
          console.log(error);
        } else {
          // Do something
        }
      });

Refer: https://support.chargebee.com/support/discussions/topics/316925 Note that I have contacted support to enable this feature on our account - just need some direction performing the search with this library.

Alternatively, I'd be happy to use the typescript library in node.js (which supposedly does support custom field filtering), but to date all .list requests return empty objects: [{}, {}]

anderslyman commented 3 years ago

Closing per resolved issue in the typescript version of this repo: https://github.com/chargebee/chargebee-typescript/issues/6