Last active
January 18, 2021 15:20
-
-
Save nazieb/c52023c3b1c3be6bdc5e41a23f4429fc to your computer and use it in GitHub Desktop.
Send Custom Header using Xendit PHP Library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CustomXenditHttpClient implements \Xendit\HttpClientInterface | |
{ | |
public function request($method, $uri, array $options = []) { | |
$client = new \GuzzleHttp\Client([ | |
'headers' => ['X-API-VERSION' => '2019-02-04'], | |
'base_uri' => \Xendit\Xendit::$apiBase, | |
]); | |
return $client->request($method, $uri, $options); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Route::post('/ovo', function () { | |
$params = [ | |
'external_id' => '12345678', | |
'amount' => 80001, | |
'phone' => '081234567890', | |
'ewallet_type' => 'OVO', | |
]; | |
\Xendit\Xendit::setHttpClient(new CustomXenditHttpClient); | |
$ovo = \Xendit\Ewallets::create($params); | |
dd($ovo); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment