Wes
18 August 2014 11:11
1
I created bill 3460080 via your API which worked just fine, however the
attachment isn’t there and I received no errors.
PHP for the attachment encoding is as follows:
$data[‘attachment’] = [
‘data’ => base64_encode(file_get_contents($filePath)),
‘file_name’ => basename($filePath),
‘content_type’ => ($receiptExtension === ‘jpg’ ? ‘image/jpg’ :
‘application/x-pdf’)
];
Any ideas?
Cheers,
Wes
Wes
18 August 2014 13:31
2
Aha! Oops, thanks for that - spot on!
Took me a moment to spot what was going on here — it looks like you’re
passing through the attachment as a root object, instead of as a child of
the bill, so:
{
“bill”: {
“bill_details”: “etc”,
“attachment”: {
“data”: “etc”
}
}
}
is what you should be sending, while:
{
“bill”: {
“bill_details”: “etc”
},
“attachment”: {
“data”: “etc”
}
}
is what I’m seeing in the logs.
Try switching that up, and let me know if you’re still having issues (or if
that’s not what you’re seeing sent from your end).
Cheers,
-JOn Monday, 18 August 2014 12:11:52 UTC+1, Wes wrote:
I created bill 3460080 via your API which worked just fine, however the
attachment isn’t there and I received no errors.
PHP for the attachment encoding is as follows:
$data[‘attachment’] = [
‘data’ => base64_encode(file_get_contents($filePath)),
‘file_name’ => basename($filePath),
‘content_type’ => ($receiptExtension === ‘jpg’ ? ‘image/jpg’ :
‘application/x-pdf’)
];
Any ideas?
Cheers,
Wes