Currently, we return an empty array if keys like discount or fees has no data. This is poor design in standard APIs and causes confusion when parsing JSON in Swift because it's not seen as nil.
We should run a simple conditional check like so: ( ! empty( $payment->fees ) ? $payment->fees : null );
Technically this is a breaking change in data returned so would normally require a version bump to the API, but it's small enough that I propose we go ahead and put it in as is.
Yeah I think most developers will be using an empty check here anyway...which null will bass just fine. I'm a :+1: for this.
PR merged into master bug leaving open for the meantime to allow visibility and testing.
Everything that was adjusted returns null when it should for me. :+1:
I am not getting NULL for fees when empty. But I'm not totally sure I'm testing the correct thing. Is this is master right now?

@mintplugins make sure you're using v2 of the api, for force it just use /edd-api/v2/<endpoint>. Do you still see that empty fees array?
馃憤 Forcing v2 brings it back NULL:
