xendit / xendit-php

Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services, xenPlatforms
https://developers.xendit.co/api-reference/
MIT License
156 stars 76 forks source link

Uncaught API format Error #63

Closed Kristina-wulandari closed 4 years ago

Kristina-wulandari commented 4 years ago

haii, can you help this eror

Fatal error: Uncaught Xendit\Exceptions\ApiException: There was an error with the format submitted to the server. in C:\xampp\htdocs\xendit-php-master\src\HttpClient\GuzzleClient.php:166 Stack trace: #0 C:\xampp\htdocs\xendit-php-master\src\HttpClient\GuzzleClient.php(139): Xendit\HttpClient\GuzzleClient::_handleAPIError(Array) #1 C:\xampp\htdocs\xendit-php-master\src\HttpClient\GuzzleClient.php(92): Xendit\HttpClient\GuzzleClient->_executeRequest(Array, '/v2/invoices') #2 C:\xampp\htdocs\xendit-php-master\src\ApiRequestor.php(87): Xendit\HttpClient\GuzzleClient->sendRequest('POST', '/v2/invoices', Array, Array) #3 C:\xampp\htdocs\xendit-php-master\src\ApiRequestor.php(43): Xendit\ApiRequestor->_requestRaw('POST', '/v2/invoices', Array, Array) #4 C:\xampp\htdocs\xendit-php-master\src\ApiOperations\Request.php(76): Xendit\ApiRequestor->request('POST', '/v2/invoices', Array, Array) #5 C:\xampp\htdocs\xendit-php-master\src\ApiOperations\Create.php(40): Xendit\Invoice::_request('POST', '/v2/invoices', Array) #6 C:\xampp\htdoc in C:\xampp\htdocs\xendit-php-master\src\HttpClient\GuzzleClient.php on line 166

stanleynguyen commented 4 years ago

Hi @Kristina-wulandari would you mind sharing your code snippet that's throwing this error?

Kristina-wulandari commented 4 years ago

line 166 : throw new ApiException($message, $rhttp, $rcode);

for method private static function _handleAPIError($response) { $rbody = $response['body'];

    $rhttp = strval($response['code']);
    $message = $rbody['message'];
    $rcode = $rbody['error_code'];

    throw new ApiException($message, $rhttp, $rcode);
}
stanleynguyen commented 4 years ago

@Kristina-wulandari Can I also have snippet of the invoice function call?

Kristina-wulandari commented 4 years ago

use Dotenv\Dotenv; use Xendit\Xendit;

require '../vendor/autoload.php';

$dotenv = Dotenv::createImmutable(DIR . '/..'); $dotenv->load(); Xendit::setApiKey(getenv('.......'));

$params = ['external_id' => 'demo_147580196270', 'payer_email' => 'sample_email@xendit.co', 'description' => 'Trip to Bali', 'amount' => 32000 ];

$createInvoice = \Xendit\Invoice::create($params); var_dump($createInvoice);

$id = $createInvoice['id'];

$getInvoice = \Xendit\Invoice::retrieve($id); var_dump($getInvoice);

$expireInvoice = \Xendit\Invoice::expireInvoice($id); var_dump($expireInvoice);

$getAllInvoice = \Xendit\Invoice::retrieveAll(); var_dump(($getAllInvoice));

stanleynguyen commented 4 years ago

Hi @Kristina-wulandari Do you have a .env file that you are loading the API Key from?

Kristina-wulandari commented 4 years ago

yes

stanleynguyen commented 4 years ago

Looks like you are loading the .env file from the parent dir '/..'. Is that correctly setup? Maybe you can try hard-coding your API Key in first to see whether the problem is with xendit-php or with dotenv?

Kristina-wulandari commented 4 years ago

this .env file SECRET_API_KEY =scrubbed

stanleynguyen commented 4 years ago

Can you try this instead? not using dotenv at all (please replace your API key in accordingly). If this works, it means the problem stems from dotenv, not xendit-php. With that being said, if dotenv is really the problem, I can still have a look at your file structure and advise what went wrong

Xendit::setApiKey('<replace your api key here>');

$params = ['external_id' => 'demo_147580196270',
'payer_email' => 'sample_email@xendit.co',
'description' => 'Trip to Bali',
'amount' => 32000
];

$createInvoice = \Xendit\Invoice::create($params);
var_dump($createInvoice);

$id = $createInvoice['id'];

$getInvoice = \Xendit\Invoice::retrieve($id);
var_dump($getInvoice);

$expireInvoice = \Xendit\Invoice::expireInvoice($id);
var_dump($expireInvoice);

$getAllInvoice = \Xendit\Invoice::retrieveAll();
var_dump(($getAllInvoice));
Kristina-wulandari commented 4 years ago

results this invoice :

array(19) { ["id"]=> string(24) "5e819f0bc2bea912fc8cfd43" ["external_id"]=> string(17) "demo_147580196270" ["user_id"]=> string(24) "5e609abb0e34973282f96d88" ["status"]=> string(7) "PENDING" ["merchant_name"]=> string(3) "UPH" ["merchant_profile_picture_url"]=> string(46) "https://du8nwjtfkinx.cloudfront.net/xendit.png" ["amount"]=> int(32000) ["payer_email"]=> string(22) "sample_email@xendit.co" ["description"]=> string(12) "Trip to Bali" ["expiry_date"]=> string(24) "2020-03-31T07:26:02.976Z" ["invoice_url"]=> string(71) "https://invoice-staging.xendit.co/web/invoices/5e819f0bc2bea912fc8cfd43" ["available_banks"]=> array(5) { [0]=> array(7) { ["bank_code"]=> string(7) "MANDIRI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "8860843707071" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [1]=> array(7) { ["bank_code"]=> string(3) "BRI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "2621551627480" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [2]=> array(7) { ["bank_code"]=> string(3) "BNI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(12) "880851468191" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [3]=> array(7) { ["bank_code"]=> string(7) "PERMATA" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(12) "821453447117" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [4]=> array(7) { ["bank_code"]=> string(3) "BCA" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "1076617076399" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } } ["available_retail_outlets"]=> array(1) { [0]=> array(3) { ["retail_outlet_name"]=> string(8) "ALFAMART" ["payment_code"]=> string(9) "TEST10720" ["transfer_amount"]=> int(32000) } } ["available_ewallets"]=> array(0) { } ["should_exclude_credit_card"]=> bool(false) ["should_send_email"]=> bool(false) ["created"]=> string(24) "2020-03-30T07:26:03.091Z" ["updated"]=> string(24) "2020-03-30T07:26:03.091Z" ["currency"]=> string(3) "IDR" } array(19) { ["id"]=> string(24) "5e819f0bc2bea912fc8cfd43" ["external_id"]=> string(17) "demo_147580196270" ["user_id"]=> string(24) "5e609abb0e34973282f96d88" ["status"]=> string(7) "PENDING" ["merchant_name"]=> string(3) "UPH" ["merchant_profile_picture_url"]=> string(46) "https://du8nwjtfkinx.cloudfront.net/xendit.png" ["amount"]=> int(32000) ["payer_email"]=> string(22) "sample_email@xendit.co" ["description"]=> string(12) "Trip to Bali" ["expiry_date"]=> string(24) "2020-03-31T07:26:02.976Z" ["invoice_url"]=> string(71) "https://invoice-staging.xendit.co/web/invoices/5e819f0bc2bea912fc8cfd43" ["available_banks"]=> array(5) { [0]=> array(7) { ["bank_code"]=> string(7) "MANDIRI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "8860843707071" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [1]=> array(7) { ["bank_code"]=> string(3) "BRI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "2621551627480" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [2]=> array(7) { ["bank_code"]=> string(3) "BNI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(12) "880851468191" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [3]=> array(7) { ["bank_code"]=> string(7) "PERMATA" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(12) "821453447117" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [4]=> array(7) { ["bank_code"]=> string(3) "BCA" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "1076617076399" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } } ["available_retail_outlets"]=> array(1) { [0]=> array(3) { ["retail_outlet_name"]=> string(8) "ALFAMART" ["payment_code"]=> string(9) "TEST10720" ["transfer_amount"]=> int(32000) } } ["available_ewallets"]=> array(0) { } ["should_exclude_credit_card"]=> bool(false) ["should_send_email"]=> bool(false) ["created"]=> string(24) "2020-03-30T07:26:03.091Z" ["updated"]=> string(24) "2020-03-30T07:26:03.091Z" ["currency"]=> string(3) "IDR" } array(19) { ["id"]=> string(24) "5e819f0bc2bea912fc8cfd43" ["external_id"]=> string(17) "demo_147580196270" ["user_id"]=> string(24) "5e609abb0e34973282f96d88" ["status"]=> string(7) "EXPIRED" ["merchant_name"]=> string(3) "UPH" ["merchant_profile_picture_url"]=> string(46) "https://du8nwjtfkinx.cloudfront.net/xendit.png" ["amount"]=> int(32000) ["payer_email"]=> string(22) "sample_email@xendit.co" ["description"]=> string(12) "Trip to Bali" ["expiry_date"]=> string(24) "2020-03-30T07:26:04.373Z" ["invoice_url"]=> string(71) "https://invoice-staging.xendit.co/web/invoices/5e819f0bc2bea912fc8cfd43" ["available_banks"]=> array(5) { [0]=> array(7) { ["bank_code"]=> string(7) "MANDIRI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "8860843707071" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [1]=> array(7) { ["bank_code"]=> string(3) "BRI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "2621551627480" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [2]=> array(7) { ["bank_code"]=> string(3) "BNI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(12) "880851468191" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [3]=> array(7) { ["bank_code"]=> string(7) "PERMATA" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(12) "821453447117" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [4]=> array(7) { ["bank_code"]=> string(3) "BCA" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "1076617076399" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } } ["available_retail_outlets"]=> array(1) { [0]=> array(3) { ["retail_outlet_name"]=> string(8) "ALFAMART" ["payment_code"]=> string(9) "TEST10720" ["transfer_amount"]=> int(32000) } } ["available_ewallets"]=> array(0) { } ["should_exclude_credit_card"]=> bool(false) ["should_send_email"]=> bool(false) ["created"]=> string(24) "2020-03-30T07:26:03.091Z" ["updated"]=> string(24) "2020-03-30T07:26:04.373Z" ["currency"]=> string(3) "IDR" } array(3) { [0]=> array(19) { ["id"]=> string(24) "5e819f0bc2bea912fc8cfd43" ["external_id"]=> string(17) "demo_147580196270" ["user_id"]=> string(24) "5e609abb0e34973282f96d88" ["status"]=> string(7) "EXPIRED" ["merchant_name"]=> string(3) "UPH" ["merchant_profile_picture_url"]=> string(46) "https://du8nwjtfkinx.cloudfront.net/xendit.png" ["amount"]=> int(32000) ["payer_email"]=> string(22) "sample_email@xendit.co" ["description"]=> string(12) "Trip to Bali" ["expiry_date"]=> string(24) "2020-03-30T07:26:04.373Z" ["invoice_url"]=> string(71) "https://invoice-staging.xendit.co/web/invoices/5e819f0bc2bea912fc8cfd43" ["available_banks"]=> array(5) { [0]=> array(7) { ["bank_code"]=> string(7) "MANDIRI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "8860843707071" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [1]=> array(7) { ["bank_code"]=> string(3) "BRI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "2621551627480" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [2]=> array(7) { ["bank_code"]=> string(3) "BNI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(12) "880851468191" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [3]=> array(7) { ["bank_code"]=> string(7) "PERMATA" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(12) "821453447117" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [4]=> array(7) { ["bank_code"]=> string(3) "BCA" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "1076617076399" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } } ["available_retail_outlets"]=> array(1) { [0]=> array(3) { ["retail_outlet_name"]=> string(8) "ALFAMART" ["payment_code"]=> string(9) "TEST10720" ["transfer_amount"]=> int(32000) } } ["available_ewallets"]=> array(0) { } ["should_exclude_credit_card"]=> bool(false) ["should_send_email"]=> bool(false) ["created"]=> string(24) "2020-03-30T07:26:03.091Z" ["updated"]=> string(24) "2020-03-30T07:26:04.373Z" ["currency"]=> string(3) "IDR" } [1]=> array(19) { ["id"]=> string(24) "5e818fa5c2bea912fc8cfcd0" ["external_id"]=> string(17) "demo_147580196270" ["user_id"]=> string(24) "5e609abb0e34973282f96d88" ["status"]=> string(7) "EXPIRED" ["merchant_name"]=> string(3) "UPH" ["merchant_profile_picture_url"]=> string(46) "https://du8nwjtfkinx.cloudfront.net/xendit.png" ["amount"]=> int(32000) ["payer_email"]=> string(22) "sample_email@xendit.co" ["description"]=> string(12) "Trip to Bali" ["expiry_date"]=> string(24) "2020-03-30T06:20:22.748Z" ["invoice_url"]=> string(71) "https://invoice-staging.xendit.co/web/invoices/5e818fa5c2bea912fc8cfcd0" ["available_banks"]=> array(5) { [0]=> array(7) { ["bank_code"]=> string(7) "MANDIRI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "8860843704611" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [1]=> array(7) { ["bank_code"]=> string(3) "BRI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "2621551625008" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [2]=> array(7) { ["bank_code"]=> string(3) "BNI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(12) "880851465719" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [3]=> array(7) { ["bank_code"]=> string(7) "PERMATA" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(12) "821453444633" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [4]=> array(7) { ["bank_code"]=> string(3) "BCA" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "1076617074383" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } } ["available_retail_outlets"]=> array(1) { [0]=> array(3) { ["retail_outlet_name"]=> string(8) "ALFAMART" ["payment_code"]=> string(9) "TEST10709" ["transfer_amount"]=> int(32000) } } ["available_ewallets"]=> array(0) { } ["should_exclude_credit_card"]=> bool(false) ["should_send_email"]=> bool(false) ["created"]=> string(24) "2020-03-30T06:20:21.562Z" ["updated"]=> string(24) "2020-03-30T06:20:22.748Z" ["currency"]=> string(3) "IDR" } [2]=> array(19) { ["id"]=> string(24) "5e817201c2bea912fc8cfc0a" ["external_id"]=> string(17) "demo_147580196270" ["user_id"]=> string(24) "5e609abb0e34973282f96d88" ["status"]=> string(7) "EXPIRED" ["merchant_name"]=> string(3) "UPH" ["merchant_profile_picture_url"]=> string(46) "https://du8nwjtfkinx.cloudfront.net/xendit.png" ["amount"]=> int(32000) ["payer_email"]=> string(22) "sample_email@xendit.co" ["description"]=> string(12) "Trip to Bali" ["expiry_date"]=> string(24) "2020-03-30T04:13:55.238Z" ["invoice_url"]=> string(71) "https://invoice-staging.xendit.co/web/invoices/5e817201c2bea912fc8cfc0a" ["available_banks"]=> array(5) { [0]=> array(7) { ["bank_code"]=> string(7) "MANDIRI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "8860843702043" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [1]=> array(7) { ["bank_code"]=> string(3) "BRI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "2621551622332" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [2]=> array(7) { ["bank_code"]=> string(3) "BNI" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(12) "880851463139" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [3]=> array(7) { ["bank_code"]=> string(7) "PERMATA" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(12) "821453441909" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } [4]=> array(7) { ["bank_code"]=> string(3) "BCA" ["collection_type"]=> string(4) "POOL" ["bank_account_number"]=> string(13) "1076617072331" ["transfer_amount"]=> int(32000) ["bank_branch"]=> string(15) "Virtual Account" ["account_holder_name"]=> string(3) "UPH" ["identity_amount"]=> int(0) } } ["available_retail_outlets"]=> array(1) { [0]=> array(3) { ["retail_outlet_name"]=> string(8) "ALFAMART" ["payment_code"]=> string(9) "TEST10670" ["transfer_amount"]=> int(32000) } } ["available_ewallets"]=> array(0) { } ["should_exclude_credit_card"]=> bool(false) ["should_send_email"]=> bool(false) ["created"]=> string(24) "2020-03-30T04:13:53.993Z" ["updated"]=> string(24) "2020-03-30T04:13:55.238Z" ["currency"]=> string(3) "IDR" } }

Kristina-wulandari commented 4 years ago

but, i have an problem error on Balance Example file

eror : Fatal error: Uncaught Xendit\Exceptions\ApiException: The API key is forbidden to perform this request in C:\xampp\htdocs\xendit-php-master\src\HttpClient\GuzzleClient.php:166 Stack trace: #0 C:\xampp\htdocs\xendit-php-master\src\HttpClient\GuzzleClient.php(139): Xendit\HttpClient\GuzzleClient::_handleAPIError(Array) #1 C:\xampp\htdocs\xendit-php-master\src\HttpClient\GuzzleClient.php(92): Xendit\HttpClient\GuzzleClient->_executeRequest(Array, '/balance?accoun...') #2 C:\xampp\htdocs\xendit-php-master\src\ApiRequestor.php(87): Xendit\HttpClient\GuzzleClient->sendRequest('GET', '/balance?accoun...', Array, Array) #3 C:\xampp\htdocs\xendit-php-master\src\ApiRequestor.php(43): Xendit\ApiRequestor->_requestRaw('GET', '/balance?accoun...', Array, Array) #4 C:\xampp\htdocs\xendit-php-master\src\ApiOperations\Request.php(76): Xendit\ApiRequestor->request('GET', '/balance?accoun...', Array, Array) #5 C:\xampp\htdocs\xendit-php-master\src\Balance.php(70): Xendit\Balance::_request('GET', '/balance?accoun...') #6 C:\xampp\htdocs\xen in C:\xampp\htdocs\xendit-php-master\src\HttpClient\GuzzleClient.php on line 166

snipt code : require '../vendor/autoload.php';

$dotenv = Dotenv::createImmutable(DIR . '/..'); $dotenv->load(); Xendit::setApiKey('......');

$getBalance = \Xendit\Balance::getBalance('CASH'); var_dump($getBalance);

stanleynguyen commented 4 years ago

@Kristina-wulandari Yes the error message is there The API key is forbidden to perform this request Please check your API key permission in https://dashboard.xendit.co/settings/developers#api-keys. Closing this ticket as problem is with dotenv, not xendit-php. Please reach out to my email at stanley@xendit.co if you would like some help on the dotenv issue :)