TypeError Cannot read properties of undefined (reading 'id') at test-script

Can you console log the entire response as the first step, and ensure that the response is returning properly as I can’t see a problem on face value with your targeting of the endOfTermReason element.

I would also recommend removing all other code from the tests tab, and build it back up line by line, so you can work out exactly which line is failing (which means removing the tests to start with and just having a bunch of console logs before adding the tests back in one by one).

  • Parse your response
  • Console log your response.
  • Console log the endOfTermReason element.
const jsonData = pm.response.json();
console.log(jsonData);
console.log(jsonData.data.endOfTermReason);

No setting of collection variables at this point. See how that goes. Does this at least work?