const request = require('request');
const options = {
method: 'POST',
url: 'https://api.betterez.com/sales/order',
headers: {
authorization: 'Bearer {{jwtToken}}',
'Content-Type': 'application/json;charset=UTF-8',
Accept: 'application/json, text/plain, */*',
'x-api-key': '{{x-api-key}}'
},
body: '{"cartId": "{{cartId}}", Id": "{{providerId}}", "customFields": [],"payments": [{"method": "online_credit","amount": "{{total}}","ccnumber": "4111111111111111","expiryMonth": "12","expiryYear": "2020","description": "Purchase"}],"customerInfo": {"firstName": "{{customer-first-name}}","lastName": "{{customer-last-name}}","email": "{{customer-email}}","phone": "{{customer-phone-number}}","street": "{{customer-address}}","city": "{{customer-city}}","countryId": "{{customer-country-code}}","country": "{{customer-country-name}}","province": "{{customer-province}}","zip": "{{customer-postal-code}}","emailSubscriptionOptIn": false},"channel": "agency-backoffice"}'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});