public function createOrder(array $data, $klarnaIdempotencyKey = null)
    {
        $headers = ['Content-Type' => 'application/json'];
        if (!is_null($klarnaIdempotencyKey)) {
            $headers['Klarna-Idempotency-Key'] = $klarnaIdempotencyKey;
        }

        return $this->request(
            'POST',
            $this->getLocation() . '/order',
            $headers,
            $data !== null ? \json_encode($data) : null
        )
        ->status('200')
        ->contentType('application/json')
        ->getJson();
    }
public function createOrder(array $data, $klarnaIdempotencyKey = null)
    {
        $headers = ['Content-Type' => 'application/json'];
        if (!is_null($klarnaIdempotencyKey)) {
            $headers['Klarna-Idempotency-Key'] = $klarnaIdempotencyKey;
        }

        return $this->request(
            'POST',
            $this->getLocation() . '/order',
            $headers,
            $data !== null ? \json_encode($data) : null
        )
        ->status('200')
        ->contentType('application/json')
        ->getJson();
    }
public function createOrder ( array $ data , $ klarnaIdempotencyKey = null ) { $ headers = [ 'Content-Type' => 'application/json' ] ; if ( ! is_null ( $ klarnaIdempotencyKey ) ) { $ headers [ 'Klarna-Idempotency-Key' ] = $ klarnaIdempotencyKey ; } return $ this -> request ( 'POST' , $ this -> getLocation ( ) . '/order' , $ headers , $ data !== null ? \ json_encode ( $ data ) : null ) -> status ( '200' ) -> contentType ( 'application/json' ) -> getJson ( ) ; }
Creates order using Customer Token.

@param array  $data Order data
@param string $klarnaIdempotencyKey Idempotency Key

@throws ConnectorException When the API replies with an error response
@throws RequestException   When an error is encountered
@throws \RuntimeException  If the location header is missing
@throws \RuntimeException  If the API replies with an unexpected response
@throws \LogicException    When Guzzle cannot populate the response

@return array created order data
Creates order using Customer Token .