代码之家  ›  专栏  ›  技术社区  ›  sulimmesh

Square Connect API V2 ListCustomers未返回所有客户

  •  1
  • sulimmesh  · 技术社区  · 8 年前

    我正在使用Square Connect API V2,试图做一些非常简单的事情:列出我的所有客户。从我的方形仪表板上可以看到,我有大约8k个客户,但使用ListCustomers端点时,我只收到151个客户。看看我的电话,看起来我只有一个分页 cursor ,从我的第一个请求开始,之后就没有了。以下是相关代码供参考:

    def get_customers(api, cursor=None):
        customers = {}
        count = 0
        while cursor or count == 0:
            response = api.list_customers(cursor=cursor)
            cursor = response.cursor
            customers[count] = response.customers
            count += 1
        return customers
    

    151对8k是一个巨大的区别,使这个电话毫无用处。ListCustomers不会返回所有客户,这是一种已知的行为吗?

    编辑:再深入一点,我发现Square将客户分为“由Square创建的”和“由您创建的”。ListCustomers端点似乎只返回“由您创建”的客户,而我的大多数客户都是由Square创建的。因此,为了完善这个问题,我如何从Connect API v2返回所有客户,包括Square创建的客户?

    1 回复  |  直到 8 年前
        1
  •  2
  •   tristansokol    8 年前

    要回答您的编辑, 你不能 . ListCustomers端点将仅返回您通过CreateCustomer或Square应用程序添加到Square帐户的客户。