Uncaught Error: Call to a member function sign()

  Kiến thức lập trình

So i’m trying to add amazon pay to my website and i’m getting this error:

Fatal error: Uncaught Error: Call to a member function sign() on array in line 4993

below is the line 4993

` public function createSignature($http_request_method, $request_uri, $request_parameters, $pre_signed_headers, $request_payload, $timeStamp){
$rsa = $this->setupRSA();

        $pre_signed_headers['X-Amz-Pay-Date'] = $timeStamp;
        $pre_signed_headers['X-Amz-Pay-Host'] = $this->getHost($request_uri);

        $hashedPayload = $this->hexAndHash($request_payload);
        $canonicalURI = $this->getCanonicalURI($request_uri);
        $canonicalQueryString = $this->createCanonicalQuery($request_parameters);
        $canonicalHeader = $this->getHeaderString($pre_signed_headers);
        $signedHeaders = $this->getCanonicalHeadersNames($pre_signed_headers);
        
        $canonicalRequest = (
            $http_request_method . "n" .
            $canonicalURI . "n" .
            $canonicalQueryString . "n" .
            $canonicalHeader . "n" .
            $signedHeaders . "n" .
            $hashedPayload
        );

        $hashedCanonicalRequest = $this->getAlgorithm() . "n" . $this->hexAndHash($canonicalRequest);
        
        $signature = $rsa->sign($hashedCanonicalRequest);
        if ($signature === false) {
            throw new Exception('Unable to sign request, is your RSA private key valid?');
        }

        return base64_encode($signature);
    }`

i have tired everything i know and can’t fix what is going on.

New contributor

crazyadamla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT