2017-06-21 93 views
-1

我想要檢索一個使用方形PHP SDK的客戶列表。如果我將$cursor留空,我可以看到我所有客戶信息的列表。如何使用分頁光標通過名稱接收客戶?示例代碼如下:什麼是分頁遊標?我怎樣才能使用它

<?php 
    require_once(__DIR__ . '/vendor/autoload.php'); 

    // Configure OAuth2 access token for authorization: oauth2 
    SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); 

    $api_instance = new SquareConnect\Api\CustomersApi(); 
    // string | A pagination cursor returned by a previous call to this endpoint. 
    //Provide this to retrieve the next set of results for your original query. 
    //See [Paginating results](#paginatingresults) for more information. 
    $cursor = "cursor_example"; 
    try { 
     $result = $api_instance->listCustomers($cursor); 
     print_r($result); 
    } catch (Exception $e) { 
     echo 'Exception when calling CustomersApi->listCustomers: ' 
       , $e->getMessage(), PHP_EOL; 
    } 
?> 

回答

0

分頁遊標不允許您通過名稱查詢客戶。如果您有多個客戶的「頁面」,那麼您可以通過提供代表下一頁的令牌來獲得更多客戶。

如果您有足夠的客戶填充多個頁面,則會在響應中返回一個遊標。