Closed fwouts closed 2 years ago
I can answer this myself after checking network logs in the browser: creation_method: "reimbursement"
🎉
@fwouts , you'll find that setting that parameter doesn't affect expense calculations. In general, the Splitwise API doesn't allow negative costs or shares.
If you'd like to enter a reimbursement, you'll have to calculate an "inverse expense," if you will. In a typical expense for $X with one payer and K users, the payer paid
$X, and everyone owed
$X/K. In a reimbursement, everyone paid
$X/K (which you can put in the paid
field), and the person who received the reimbursement owed
$X. That is, you can think of a "reimbursement" expense of $X as a normal expense of $X with the paid
and owed
fields reversed.
Hope this helps!
Is it possible to create a reimbursement transaction with the Splitwise API?
I usually do this by entering a negative amount in the web app (it doesn't work on Android), but if I try to enter a negative amount in a createExpense API call, it's rejected. I imagine there's another endpoint for that, but perhaps it's not publicly exposed?
Thank you :)