# Stripe integration returns no data

**URL:** <https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981>\
**Category:** Help me!\
**Created:** [January 10, 2022, 2:07pm UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981 "2022-01-10T14:07:13Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![baptiste](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/baptiste/32/3812_2.png) [@baptiste](https://community.forestadmin.com/u/baptiste)\
**Post date:** [January 10, 2022, 2:07pm UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981/1 "2022-01-10T14:07:13Z")

</div>

## Feature(s) impacted

Stripe integration

## Observed behavior

My stripe fields are not returning any data  
**I’m currently using a sandbox stripe api key**

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/4/4d9da85c507d689b4a40aedebb2465ab79774ac5.png)

## Expected behavior

Having Stripe data being returned (my Stripe sandbox has a lot of cards / payments linked to my clients local database)

## Failure Logs

Here is my forestadmin.js middleware

```javascript
const chalk = require('chalk');
const path = require('path');
const Liana = require('forest-express-sequelize');
const { objectMapping, connections } = require('../models');

module.exports = async function forestadmin(app) {
  app.use(await Liana.init({
    configDir: path.join(__dirname, '../forest'),
    envSecret: process.env.FOREST_ENV_SECRET,
    authSecret: process.env.FOREST_AUTH_SECRET,
    schemaDir: process.env.FOREST_SCHEMA_DIR,
    objectMapping,
    connections,
    integrations: {
      stripe: {
        apiKey: process.env.STRIPE_ENV_KEY,
        mapping: 'clients.stripe_client_id',
        stripe: require('stripe')
      }
    }
  }));

  console.log(chalk.cyan('Your admin panel is available here: https://app.forestadmin.com/projects'));
};

```

In the Stripe API logs, the API seems to never be called at all.  
I don’t have any error in the forest node console.

## Context

- Project name: Blockpulse Admin Panel
- Team name: Operations
- Environment name: Development

---

<div class="post-metadata">

**Author:** ![morganperre](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/morganperre/32/1296_2.png) [@morganperre](https://community.forestadmin.com/u/morganperre)\
**Post date:** [January 10, 2022, 2:31pm UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981/2 "2022-01-10T14:31:33Z")

</div>

Hello @baptiste ! 👋 Welcome to our community 🎉 🎊

Looking at your mapping the Stripe Customer ID should be find in the _ **stripe\_client\_id** _ field of the _ **clients** _ collection, am I right ?

Can you share the _ **clients** _ collection to check your collection name ? (I’m thinking you should use **client** instead of **clients** )

Thanks in advance.

Kind regards,  
Morgan.

---

<div class="post-metadata">

**Author:** ![baptiste](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/baptiste/32/3812_2.png) [@baptiste](https://community.forestadmin.com/u/baptiste)\
**Post date:** [January 10, 2022, 2:38pm UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981/3 "2022-01-10T14:38:17Z")

</div>

Hello,

Yes my clients collection has a stripe\_client\_id field.

this is my clients collection (default one) :

```javascript
const { collection } = require('forest-express-sequelize');

collection('clients', {
  actions: [],
  fields: [],
  segments: [],
});

```

I tried writing a wrong value for the mapping and got an error message saying Stripe integration couldn’t be started so I’m guessing that my value is valid.

---

<div class="post-metadata">

**Author:** ![morganperre](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/morganperre/32/1296_2.png) [@morganperre](https://community.forestadmin.com/u/morganperre)\
**Post date:** [January 10, 2022, 3:03pm UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981/4 "2022-01-10T15:03:48Z")

</div>

Hey again,

> [@baptiste](#):
>
> I tried writing a wrong value for the mapping and got an error message saying Stripe integration couldn’t be started so I’m guessing that my value is valid.

You are right, everything looks ok. A colleague will try to reproduce and take over the thread.

In the meanwhile, can you share the sequelize definition of **clients**?

Kind regards,  
Morgan

---

<div class="post-metadata">

**Author:** ![baptiste](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/baptiste/32/3812_2.png) [@baptiste](https://community.forestadmin.com/u/baptiste)\
**Post date:** [January 10, 2022, 3:10pm UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981/5 "2022-01-10T15:10:40Z")

</div>

Hello,

thank you for the quick answers.

This is my **clients** model :

```javascript
// This model was generated by Forest CLI. However, you remain in control of your models.
// Learn how here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models
module.exports = (sequelize, DataTypes) => {
  const { Sequelize } = sequelize;
  // This section contains the fields of your model, mapped to your table's columns.
  // Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
  const Clients = sequelize.define('clients', {
    accountId: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    email: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    companyName: {
      type: DataTypes.STRING,
    },
    addressLine: {
      type: DataTypes.STRING,
    },
    postcode: {
      type: DataTypes.STRING,
    },
    city: {
      type: DataTypes.STRING,
    },
    tvaIntraCommunity: {
      type: DataTypes.STRING,
    },
    billingStartDate: {
      type: DataTypes.DATE,
    },
    billingEndDate: {
      type: DataTypes.DATE,
    },
    paymentMethodId: {
      type: DataTypes.STRING,
    },
    createdAt: {
      type: DataTypes.DATE,
      defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
    },
    updatedAt: {
      type: DataTypes.DATE,
    },
    stripeClientId: {
      type: DataTypes.STRING,
    },
    pennylaneClientId: {
      type: DataTypes.STRING,
    },
    subscribed: {
      type: DataTypes.BOOLEAN,
    },
  }, {
    tableName: 'clients',
    underscored: true,
    schema: process.env.DATABASE_SCHEMA,
  });

  // This section contains the relationships for this model. See: https://docs.forestadmin.com/documentation/v/v6/reference-guide/relationships#adding-relationships.
  Clients.associate = (models) => {
    Clients.belongsToMany(models.coupons, {
      through: 'clientCoupon',
      foreignKey: 'client_id',
      otherKey: 'coupon_id',
      as: 'couponsThroughClientCoupons',
    });
    Clients.hasMany(models.invoices, {
      foreignKey: {
        name: 'clientIdKey',
        field: 'client_id',
      },
      as: 'invoices',
    });
    Clients.hasMany(models.operations, {
      foreignKey: {
        name: 'clientIdKey',
        field: 'client_id',
      },
      as: 'operations',
    });
  };

  return Clients;
};

```

Regards,  
Baptiste

---

<div class="post-metadata">

**Author:** ![morganperre](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/morganperre/32/1296_2.png) [@morganperre](https://community.forestadmin.com/u/morganperre)\
**Post date:** [January 10, 2022, 3:28pm UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981/6 "2022-01-10T15:28:17Z")

</div>

I see that the stripeClientId is defined as following:

> [@baptiste](#):
>
> `stripeClientId`

Can you try to change the mapping to:

```javascript
mapping: 'clients.stripeClientId',

```

Does it help ?

Kind regards,  
Morgan

---

<div class="post-metadata">

**Author:** ![baptiste](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/baptiste/32/3812_2.png) [@baptiste](https://community.forestadmin.com/u/baptiste)\
**Post date:** [January 10, 2022, 3:31pm UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981/7 "2022-01-10T15:31:40Z")

</div>

Yes I did try that before posting and didn’t work.

Regards,  
Baptiste

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [January 10, 2022, 3:44pm UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981/8 "2022-01-10T15:44:26Z")

</div>

Hey @baptiste,

Coudl you give me the version of the `stripe` package you are using ? 🙏

I’ll check on my setup if I’m able to reproduce and I’ll let you know.

---

<div class="post-metadata">

**Author:** ![baptiste](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/baptiste/32/3812_2.png) [@baptiste](https://community.forestadmin.com/u/baptiste)\
**Post date:** [January 10, 2022, 3:58pm UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981/9 "2022-01-10T15:58:30Z")

</div>

Hello,  
my stripe version is **8.195.0**.

This is my package.json :

```javascript
{
  "name": "blockpulse-admin-dev",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node ./server.js"
  },
  "dependencies": {
    "body-parser": "1.19.0",
    "chalk": "~1.1.3",
    "cookie-parser": "1.4.4",
    "cors": "2.8.5",
    "debug": "~4.0.1",
    "dotenv": "~6.1.0",
    "express": "~4.17.1",
    "express-jwt": "6.0.0",
    "forest-express-sequelize": "^8.0.0",
    "morgan": "1.9.1",
    "pg": "~8.2.2",
    "require-all": "^3.0.0",
    "sequelize": "~5.15.1",
    "stripe": "^8.195.0"
  }
}

```

Regards,  
Baptiste

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [January 10, 2022, 3:59pm UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981/10 "2022-01-10T15:59:03Z")

</div>

Just did a quick setup on my end, and I’m able to fetch data correctly using `"stripe": "^8.195.0"`, on a setup similar to yours

```javascript
      integrations: {
        stripe: {
          apiKey: process.env.STRIPE_API_KEY,
          mapping: "clients.stripeClientId",
          stripe: require("stripe"),
        },
      },

```

Do you have any error logs in your browser developer console or on your agent ?

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/9/9a6c57700e84849e7e12f28ce1cb474d447813ff.png)

---

<div class="post-metadata">

**Author:** ![baptiste](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/baptiste/32/3812_2.png) [@baptiste](https://community.forestadmin.com/u/baptiste)\
**Post date:** [January 10, 2022, 4:36pm UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981/11 "2022-01-10T16:36:20Z")

</div>

After checking again with `clients.stripeClientId`, I noticed I am now successfully getting the payments data but it is incomplete : I only have 7 payments displayed while there are 34 payments with this customer, and the cards / bank accounts are empty when they should not (this is what baited me thinking it didn’t work)

> Only displaying 7 payments

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/7/7e4e30fae2baaa51773479ae81281fb1e8424ae2.png)

> Customer payment methods in stripe
> 
> ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/3/39b5ecf937e2d8bcac2d739e4cbb717d6f29f891.png)

There are no errors in the browser console and in the node app.

Regards,  
Baptiste

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [January 10, 2022, 5:07pm UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981/12 "2022-01-10T17:07:11Z")

</div>

Weird indeed.

I’m currently not able to reproduce.

Would it eventually be possible for you to share (as DM & obfuscated) the response of the `HTTP GET /stripe_payments` call?  
If not, could you eventually just check if the number of records returned in the response of this service matches with the number of records you have in stripe?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [January 11, 2022, 8:09am UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981/13 "2022-01-11T08:09:22Z")

</div>

Thanks for the DM. I can see that the response sent by your agent only contains 7 payments, so the issue is not a frontend one.

On my end, I don’t see anything for now that can lead to this result, either in the code, or in my test project - thus I’m still unable to reproduce.

Just to check if this is indeed an agent issue, would you mind running [this specific stripe curl command on the same client](https://stripe.com/docs/api/payment_intents/list), just to check if the stripe API returns you the 34 results you are mentioning?

---

<div class="post-metadata">

**Author:** ![baptiste](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/baptiste/32/3812_2.png) [@baptiste](https://community.forestadmin.com/u/baptiste)\
**Post date:** [January 11, 2022, 8:29am UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981/14 "2022-01-11T08:29:59Z")

</div>

Hello,

The API returned me the full 34 payments list with the` limit: 40` parameter.  
Sent you the response in DM.

Regards

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [January 11, 2022, 9:43am UTC](https://community.forestadmin.com/t/stripe-integration-returns-no-data/3981/15 "2022-01-11T09:43:11Z")

</div>

After checking the output, I can see that the payment that does not appear in the UI are payment issued with a method other than `card`.

We currently don’t supported issued payment with method `!= card`, so the best I can do is to push this as a feature suggestion in our product board. I can’t provide any ETA for feature suggestions.

In the meantime, the best solution I can provide is based on [Smart Collection](https://docs.forestadmin.com/documentation/reference-guide/collections/create-a-smart-collection).
