我试图收到收据,但我不能! 我已经设置了" request_receipt"在我的应用程序的AUTHORIZATIONS中,没有任何变化。 我需要做些什么来获得收据?
<script>
var headers = {
'Accept-Language':'en_US',
'Content-Type':'application/json'
};
function callback(error, response, body) {
if(error){
console.log(error);
}else if (response.statusCode == 200) {
var jsonBody = JSON.parse(body);
headers['Authorization'] = `Bearer ${jsonBody.access_token}`;
getUserHistory(req,res);
}
}
request.post(options, callback);
});
function getUserHistory(req,res){
var options = {
url: 'https://api.uber.com/v1.2/history',
headers:headers
};
request.get(options, (error, response, body) => {
if(error){
console.log(error);
}else if (response.statusCode == 200) {
var bodyJson = JSON.parse(body);
bodyJson.history.map(function(model){
var options = {
url: 'https://api.uber.com/v1.2/requests/'+model.request_id+'/receipt',
headers:headers
};
request.get(options, (error, response, body) => {
if(error){
console.log(error);
}else if (response.statusCode == 200) {
res.send(body);
}
});
})
}
});
}
</script>
运行此代码,我可以看到此消息: