Answer the question
In order to leave comments, you need to log in
Why does it return text/html instead of application/json?
I am sending a request like this:
const headers = new HttpHeaders({
'Content-Type': 'application/json',
Authorization: 'Bearer 3e5cac39-7e38-4139-8fd6-30adc06a61bd',
});
const body = {
notifyUrl: 'https://your.eshop.com/notify',
customerIp: '127.0.0.1',
merchantPosId: '145227',
description: 'RTV market',
currencyCode: 'PLN',
totalAmount: '21000',
buyer: {
email: '[email protected]',
phone: '654111654',
firstName: 'John',
lastName: 'Doe',
language: 'pl',
},
products: [
{
name: 'Wireless Mouse for Laptop',
unitPrice: '15000',
quantity: '1',
},
{
name: 'HDMI cable',
unitPrice: '6000',
quantity: '1',
},
],
};
return this.http
.post('https://secure.payu.com/api/v2_1/orders', body, {
headers: headers,
})
.subscribe((res) => {
console.log(res);
});
{
"status":{
"statusCode":"SUCCESS",
},
"redirectUri":"{payment_summary_redirection_url}",
"orderId":"WZHF5FFDRJ140731GUEST000P01",
"extOrderId":"{YOUR_EXT_ORDER_ID}",
}
Answer the question
In order to leave comments, you need to log in
This is a question to the server why it returns html. Understand networking.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question