splitwise/api-docs

create_expense for a group

goleary opened this issue ยท 6 comments

I'd like to use the create_expense endpoint to submit an expense for a group and have it split amongst all members. Does the splitwise API provide this functionality?

I'm really hoping I don't have to pull a list of all group members and then do all of the math on my end and then submit the expense in a separate request.

When I submit an expense with group_id populated, but no user I get an error...

jas14 commented

If you provide the ID of a group of which the requesting user is a member via the top-level group_id parameter, and a top-level param split_equally (set to true), we'll split equally between all members of that group.

EDIT: When using the split_equally flag, you cannot provide individual users, only a group.

I see. This is exactly what I was looking for, thanks!

That said, due to the lack of documentation perhaps this issue should remain open until this information is available self serve?

I'd be happy to help contribute to the docs, but considering the lack of any details in the (new) expense section, I'm a bit hesitant. It seems like someone on your end should get it started.

:)

Thanks for the notes here. Helped me successfully implement create_expense

jas14 commented

The docs have been updated: https://dev.splitwise.com/#create_expense

unreal, thanks Joe! They look great.

jas14 commented

Thanks go to @mgod for #32! ๐Ÿ™‚