javascript – How do you store state.Data and state.isValid in ADYEN Card Component?

So I’ve read the documentation and have followed everything so far. However, in the handleOnChange function, I cannot post the data because it gives the error:

Here’s how I’m currently trying to post the data, I’m open for any suggestions.

function handleOnChange(state, component) {
  state.isValid 
  state.data 
  component 
  if (state.isValid === true) {
    this.http.post(environment.paymentFunctionurl + '/', { amount: this.amount, content: state.data}).subscribe((res) => {
      console.log(res);
    })
  }
}

I’ve tried storing them as variables but it results as undefined. What am I missing here?