计算twilio子帐户使用的计费

问题描述 投票:0回答:1

我需要上个月使用特定的twilio子帐户。我按照官方文档中的说明尝试了,我在传递主帐户的Sid和Auth Token时得到了回复但是,在传递子帐户凭据时我无法获得任何详细信息。这是我试过的代码。

$sid    = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$token  = "your_auth_token";
$twilio = new Client($sid, $token);

$calls = $twilio->calls
                ->read(array("startTime" => new \DateTime('2018-1-15')));

foreach ($calls as $record) {
    print($record->sid);
}
php laravel twilio twilio-api twilio-php
1个回答
0
投票

你可以使用Twilio RecordSource并传递CategoryEnum作为TotalPrice

$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$categoryEnum = "total_price"
$client = new Client($sid, $token, $categoryEnum);

在C#中

TwilioClient.Init(SID, AuthToken);
DateTime currentDate = DateTime.Now;
DateTime startDate = new DateTime(currentDate.Year, currentDate.Month, 1);
var twilioPrice = (await RecordResource.ReadAsync(twilioSubAccount.SID, 
        category: RecordResource.CategoryEnum.Totalprice,
        startDate: startDate,
        endDate: startDate.AddMonths(1)))
        .FirstOrDefault();
© www.soinside.com 2019 - 2024. All rights reserved.