Exchanging x-amzn-marketplace-token for customerID

170 Views Asked by At

I am trying to get a token that has been POSTed to my application from AWS Marketplace. It is NOT working. Using the debugger I can see that the token from AWS is blank. Once I get the CustomerID I will need to use it to getEntitlements. Why is there no token?

'''

           $config = [
                'credentials'  => new Credentials(getenv('AWS_ACCESS_KEY_ID'), getenv('AWS_SECRET_ACCESS_KEY')),
                'region'       => 'us-east-1',
                'version'      => 'latest'
            ];

            $client = new MarketplaceMetering\MarketplaceMeteringClient($config);

            $headers = $this->input->request_headers();
            $x_amzn_marketplace_token = $this->input->get_request_header('x-amzn-marketplace-token');

            $result = $client->resolveCustomer(['RegistrationToken' => $x_amzn_marketplace_token]);
            $this->session->set_userdata('ProductCode', $result['ProductCode']);
            $this->session->set_userdata('CustomerIdentifier', $result['CustomerIdentifier']);
            $this->session->set_userdata('CustomerAWSAccountId', $result['CustomerAWSAccountId']);

'''

0

There are 0 best solutions below