My current method involves using fetch to send URL encoded form data:
private purchase = async () => {
const { token } = await this.state.instance.requestPaymentMethod();
const formData = [];
formData.push(`${encodeURIComponent("paymentToken")}=${encodeURIComponent(token)}`);
// @ts-ignore
const result = await fetch(`http://example.com/checkout`, {
method: "post",
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
},
body: formData,
});
}
The solution works with the @ts-ignore annotation, but I am seeking a type that can replace it. Any suggestions on what type to use in this scenario?