Skip to content

Commit 19adafd

Browse files
committed
Add account-related examples for balance and configuration
1 parent dba7cea commit 19adafd

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

.env-example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ RECIPIENT_NUMBER
88
TO_NUMBER=
99
NEXMO_SECRET_ID=
1010
INSIGHT_NUMBER=
11+
SMS_CALLBACK_URL=

account/account-balance.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
require_once __DIR__ . '/../config.php';
3+
require_once __DIR__ . '/../vendor/autoload.php';
4+
5+
$basic = new \Nexmo\Client\Credentials\Basic(NEXMO_API_KEY, NEXMO_API_SECRET);
6+
$client = new \Nexmo\Client($basic);
7+
8+
$response = $client->account()->getBalance();
9+
echo round($response->data['balance'], 2) . " EUR\n";

account/configure-account.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
require_once __DIR__ . '/../config.php';
3+
require_once __DIR__ . '/../vendor/autoload.php';
4+
5+
$basic = new \Nexmo\Client\Credentials\Basic(NEXMO_API_KEY, NEXMO_API_SECRET);
6+
$client = new \Nexmo\Client($basic);
7+
8+
$response = $client->account()->updateConfig([
9+
"sms_callback_url" => SMS_CALLBACK_URL
10+
]);
11+
print_r($response->data);

composer.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)