Substracting credits from user account

Hi i have problem. I ve created fileld: UsersCredits. Id id like that each time my API will GET the number from external service, this number will be substracted from the users account. so this
USERSCREDITS - [value received from GET API]

First workflow: Get data from API.

2nd workflow. : Edit current user. UsersCredits = UserCredits - result of Step 1's API's Credit#

That should do it!

I got get data this ok
What is the workflow EDIT CURRENT USER?


got something like this

Yes, it should be working

No it only change the value :frowning: at the begining have 55 credits and after workflow is done still have 55. it only updated the field

On your test user, delete the User Credits entirely so it’s blank.
Make the workflow UserCredits = API call’s Transaction Credits.

This way you’ll save the result.

Now you know if the API call is returning 0 or if it is correctly returning a number. My guess is that the API is returning 0 or nothing.

Well api returns value “-55” so in the cell ive created: VideoCost i have value -55. So how to make to subsctract this cost form the eg 300 credits that are stored in cel: UserCredits

Zrzut ekranu 2023-09-29 o 00.58.59

we ll i dont know what to do

Other way how to do when button is clicked than to the value in the sell will be added value returned by API

Has any one an idea how to handle it?

Well this shoud work but … instead of making simple math this change the value of the cell . So i have 300 and it change to the value from API to 55 :). but it should be 245