Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from scottconnerly/master
Browse files Browse the repository at this point in the history
Post the whole JSON object at once
  • Loading branch information
heathroehr authored Mar 27, 2018
2 parents e99762f + a8b2b56 commit 661b1e3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/PaymentSpring.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ public static function makeRequest($path, $params = array(), $isPost = false){
$curlOptions = array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => self::$apiBaseURL . $path,
CURLOPT_HTTPHEADER => array('Authorization: Basic '. base64_encode( self::$privateKey . ":" ) )
CURLOPT_HTTPHEADER => [
'Authorization: Basic '. base64_encode( self::$privateKey . ":" ),
'Content-Type: application/json'
]
);
if($isPost){
$curlOptions = self::constructPostRequest($curlOptions, $params);
Expand All @@ -57,7 +60,7 @@ public static function makeRequest($path, $params = array(), $isPost = false){

public static function constructPostRequest($options, $params){
$options[CURLOPT_POST] = TRUE;
$options[CURLOPT_POSTFIELDS] = $params;
$options[CURLOPT_POSTFIELDS] = json_encode($params);
return $options;
}

Expand Down

0 comments on commit 661b1e3

Please sign in to comment.