Update the remittance status of a transaction by calling an external API
I have a type / table of “Transaction” with a remittanceStatus field. We also have a unique Transaction ID and unique Merchant ID fields.
There is no direct way to get the remittanceStatus of a single transaction using the externalAPI. Instead, we must:
Call the “BatchRun’s” API using the Merchant ID as a parameter to return all the runs for that Merchant in the last 30 days. The response contains a “runs” array, which has multiple entries for the same Run ID but no Transaction ID
Using a combination of Run ID and Merchant ID we can call the “RunTransactions” API which contains all the transcations remitted within that single batch Run. The response contains an array with entries for each Transaction, containing the Transaction ID (which I have in my DB already) and that sweet RemittanceStatus I need.
First of all… how do I do this?? But more specifically…
I can pass the Merchant ID to the BatchRuns’s API but how do I retrieve / use a list of unique Run ID’s to use in the next API call?
Then how could I use this list of unique Run ID’s to make an individual “RunTransactions” API call to return a list of transaction information to update my database
I’m really familiar with the Bubble backend and API connector, etc so all that is cool it’s just managing the arrays to get what I need. Somewhere in here will be recursive scheduled API’s and perhaps a Make.com job to re-initiate it automatically each evening. My plan is to run the recursive workflow per Merchant as a way of breaking the job down but even so, I’m struggling to find a way to deal with a list of Run ID’s which then gives me a list of Transaction ID’s to then update my list of transactions in my DB.
The BatchRun’s API returns many (duplicated) Run ID’s for a single Merchant.
Using a single Run ID we can use the “RunTransactions” API to return many Transactions ID’s per Run
i.e. A Merchant has many Runs returned as an array and a Run has many Transactions as an array. So it needs a loop in a loop using the two API calls. I just want to update the transactions in my database with the latest transaction status from the third party.
I need to take you up on your offer as I’m still stuck. Your examples make sense - although I’m getting data rather than posting - it definitely helped. The video you provided I think is the key to all this but this is where I’m stuck, as follows:
At 7:52 in the video when we’re trying to set the “Type of thing” on the action “Schedule API workflow on a list”, I do not have the option to choose my API Call, ListRemittanceRuns from the dropdown list. It just isn’t there. My API call is set to “Action” and is initialised as I’ve chosen it in the first step of the workflow but the only options in the “Type of thing” dropdown are Database tables and API calls set to “Data”. How is it that “Get Post” above is an “Action” API call but appears in this list of “Types of things” and why isn’t my ListRemittanceRuns appearing in this dropdown? Screenshots below.
I’ve tried to setup data API calls which do appear in the “Type of thing” dropdown but then there is a type mis-match between this and the “List to run on”, results of step 1 as that is a different (action) API call. I’ve since removed the API calls set to “data”
I’ve also tried setting the type of thing to “Text” and formatting the “list to run on” as text but again gives me a mismatch
I’ve built my API’s in a private plugin so that I can have Dev and Live API keys and endpoints. Out of sheer curiosity, I created the API Call within the Bubble API Connector to see if appears… and it does! This seems like a bug in Bubble which stops “Action” API calls within private plugins appearing in the “types of thing” dropdown. “Data” API calls in a private pluing seem fine.
With this first hurdle done, I can attempt the full solution any pointers are still welcome!