diff --git a/README.md b/README.md index eed0107..d3ebc64 100755 --- a/README.md +++ b/README.md @@ -34,9 +34,9 @@ You can specify which environment when initializing `YouCanPay` instance ```php use YouCan\Pay\YouCanPay; - -$youCanPay = YouCanPay::instance()->useKeys('my-private-key', 'my-public-key'); // enable sandbox mode YouCanPay::setIsSandboxMode(true); + +$youCanPay = YouCanPay::instance()->useKeys('my-private-key', 'my-public-key'); ``` diff --git a/src/API/HTTPAdapter/CurlHTTPAdapter.php b/src/API/HTTPAdapter/CurlHTTPAdapter.php index fb09ad8..0a80f32 100644 --- a/src/API/HTTPAdapter/CurlHTTPAdapter.php +++ b/src/API/HTTPAdapter/CurlHTTPAdapter.php @@ -35,7 +35,7 @@ protected function parseHeaders($headers) public function request(string $method, string $endpoint, array $params = [], array $headers = []): Response { - $curl = curl_init(sprintf($this->getBaseUrl(), $endpoint)); + $curl = curl_init(sprintf('%s%s', $this->getBaseUrl(), $endpoint)); $headers["Content-Type"] = "application/json"; $headers["Accept"] = "application/json"; @@ -47,7 +47,7 @@ public function request(string $method, string $endpoint, array $params = [], ar switch (strtolower($method)) { case 'post': curl_setopt($curl, CURLOPT_POST, true); - curl_setopt($curl, CURLOPT_POSTFIELDS, $httpBody); + curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($params)); break; case 'get':