const request = require('request');
const options = {
method: 'POST',
url: 'https://api.betterez.com/sales/cart',
headers: {
authorization: 'Bearer {{jwtToken}}',
'Content-Type': 'application/json;charset=UTF-8',
Accept: 'application/json, text/plain, */*',
'x-api-key': '{{x-api-key}}'
},
body: {
channel: 'backoffice',
currency: {isocode: 'USD'},
items: {loan_repayment: [{loanTrxId: '{{trxId}}', loanIds: ['{{loanId}}']}]},
language: '',
providerId: '{{providerId}}',
subDomain: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});