Get Charity Campaign, no amount returned

hey there, currently trying to get a channels charity campaign but there is some fields missing that are in the documentation.

this is currently what im getting:

{
‘id’: ’ ',
‘campaign_id’: ’ ',
‘user_id’: ’ ',
‘user_name’: ’ ',
‘user_login’: ’ ',
‘target_amount’: {‘value’: 100, ‘currency’: ‘USD’, ‘decimal_places’: 2}
}

since im trying to make an external donation tracker missing the donated amount is very annoying.

any ideas?

Whats your API look like and whats the actual output?

Since you are missing a lot more than just the current_amount if thats the output you are getting.

I cannot test myself at the moment as the dashboard is broken so I cannot start a charity goal to go test with

And you shouldn’t have any user_* keys

This sounds like you have called the “Get List of Donations” endpoint (but that doesn’t have a target_amount key anyway). And not the “Get Open Charity Campaign” endpoint.

Thanks for the quick reply, im using the twitchio python ext and this is what im working with:

async def get_charity_donations(broadcaster_id, charity_access_token, client_id):
    url = "https://api.twitch.tv/helix/charity/donations"
    headers = {'Authorization': f'Bearer {charity_access_token}', 'Client-Id': client_id}
    params = {'broadcaster_id': broadcaster_id}

    async with aiohttp.ClientSession() as session:
        async with session.get(url, headers=headers, params=params) as response:

Yeah the donations endpoint gives you the amount the person donated. But it shouldn’t return a target_amount like you have here it should return an amount

To get the “target” and/or “grand total” you need “Get Charity Campaign”
Get Donations doesn’t have a target_amount key

Docs example

    {
      "id": "z1y2x3-ccdd-6677-d1e2f3",
      "campaign_id": "123-abc-456-def",
      "user_id": "8765",
      "user_login": "cool_user2",
      "user_name": "Cool_User2",
      "amount": {
        "value": 10000,
        "decimal_places": 2,
        "currency": "USD"
      }
    },

TwitchIO might be swapping the key name and is bugged?

Ok I found the issue

This API is saying “target_amount” when it should say “amount”, it is the amount the user donated it’s just the wrong key name

filing a bug report

filed

ah that makes sense, it is also returning the goal amount instead of the actual amount donated as the value

thanks for your time :slight_smile:

For me I’m getting the amount I donated

twitch api get 'charity/donations?broadcaster_id=15185913'

    {
      "campaign_id": "2E7IjWnmxUdGrIeu1H6OUEW6kPb",
      "id": "2E7IjWnmxUdGrIeu1H6OUEW6kPb-15185913-2022-11-30T14:28:47Z",
      "target_amount": {
        "currency": "USD",
        "decimal_places": 2,
        "value": 100
      },
      "user_id": "15185913",
      "user_login": "barrycarlyon",
      "user_name": "BarryCarlyon"
    }

Which is a dollar, I have six records for one dollar in my list

From twitch api get 'charity/campaigns?broadcaster_id=15185913'

image

oh yeah youre right, had the goal set to the same amount as the dono :clown_face: