Skip to content

Instantly share code, notes, and snippets.

@tperrelli
Created June 28, 2018 21:24
Show Gist options
  • Save tperrelli/27a52185a97ae4df2b294f51786f06d1 to your computer and use it in GitHub Desktop.
Save tperrelli/27a52185a97ae4df2b294f51786f06d1 to your computer and use it in GitHub Desktop.
Split
let url = 'https://api.zoop.ws/v1/marketplaces/{marketplace_id}/transactions';
url = url.replace('{marketplace_id}', Zoop.keys.marketplaceId);
let options = {
method : 'POST',
url : url,
headers : {
'Accept' : 'application/json'
},
body : {
amount : '1000',
currency : 'BRL',
description : 'Venda dividida entre vendedores',
payment_type : 'credit',
on_behalf_of : '8a563a3bf51341c597b1eb696208780d', // ID do recebedor - Alfaia
source : {
type: 'card',
card : {
// id : '999',
holder_name : 'Tiago Vasconcelos',
expiration_month : '03',
expiration_year : '2020',
security_code : '876',
card_number : '5577270004286630'
}
},
split_rules: [
{
recipient : "4ab44185ba05492491ed8738e655a750", // ID do recebedor 2 - Bob party
liable : 1,
charge_processing_fee : 0,
percentage : 50,
amount : 0
}
]
},
json: true,
auth : {
username : 'zpk_test_vBt3doR7ilwFaoyHhzrAfhbg' //sandbox
}
};
request(options, function(error, response, body) {
if (error == null) {
console.log('body: ', body);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment