猿问

Stripe.Customers.list源不返回任何内容

我创建了以下代码来获取客户的所有卡:


return stripe.customers.listSources(customerId, {

    object: "card",

    limit: 10

}).then(cards => {

    if (cards) {

        res.status(200).send({

            cards: cards.data

        });

        return;

    }

    res

        .status(500)

        .send({ error: "error getting cards" });


})

    .catch(error => {

        console.log(error);

        res.status(500).send({ error: "error getting cards" });

    });

遵循本文档:


https://stripe.com/docs/api/cards/list


我还向我的客户添加了测试卡,这些卡在仪表板中可见:

但 API 始终向我返回以下结果:


{

  object: 'list',

  data: [],

  has_more: false,

  url: '/v1/customers/<my_cus_id>/sources'

}


狐的传说
浏览 82回答 1
1回答

湖上湖

似乎使用这个代替工作:stripe.paymentMethods.list(&nbsp; &nbsp;{ customer: customerId, type: "card" })https://stripe.com/docs/api/payment_methods/list
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答