Hello,
I’m building a marketplace app and have structured my payment flow to take a payment when a booking is made and put the funds in my account and then when the refundable period has passed then transfer those funds (minus my fees) to the correct seller. Ive got the stripe api calls and everything sorted but I just can’t figure out how to schedule the transfer out part.
The funds are held by me until 48 hours before the booking time. At that time the funds are supposed to be transferred to the seller but I just can’t seem to figure out how to do this in the backend workflows. Since it has to run on a whole list of bookings I have tried to implement some ways I have seen on the forum but they all seem to be for a specific date. These bookings are obviously all at different times so it can’t be for just the one time. And there is also the possibility for bookings to be rescheduled so how do I ensure the workflow happens on the new date and not the old one?
Scheduled your workflow that transfers the funds (minus fees) on the date: [booking date] +days (-2)
Put this action in your initial booking workflow and stock the id of the workflow (result of the step schedule api workflow) in the booking for instance
And put it in the workflow that allows rescheduling after you put an action cancel a scheduled workflow
Set a recurring workflow that triggers every 24h with a schedule API workflow on a list that use the API workflow that transfers funds
list is a do search of your bookings with booking date < current date +1 days and booking date > current date. With this you will get all your bookings with a booking date in the next day.
I’ve been doing something similar and think I just figured it out. I posted a walkthrough in the original thread.
For the scheduling of individual payouts, you can add a field on whatever Thing your payout action will monitor. This field could be a “payout date” that is set when the booking is originally created (or later modified).
And/Or you could create a “Payout allowed” field on the booking of type yes/no and check that field as part of the search that builds the list as the scheduled workflow runs (which would allow you to stop the payout of individual bookings pretty easily, without impacting the others).
Thank you both for the replies. I followed @eliot1 's advice by setting a deadline and then scheduling the api workflow for that deadline which is working correctly. I think I may have been overthinking it earlier, below are some screenshots of my setup for reference:
When the charge is confirmed as successful via the webhook a booking is made and the schedule is set for the next API workflow
My newest issue is the transfer api call itself. If either of you can spot something I have done incorrectly you’d be a life saver but essentially the call is not sending the correct amount to be transferred, its only using the data that is in the API call template and not the dynamic amount I have entered.
In the screenshot below you can see that I have the amount as a dynamic figure:
Its strange because the artists stripe ID changes dynamically and I have tried entering the amount as a number and as text but neither make a difference. Any ideas?
For the amount, if you use Stripe API your amount should be in cent. So your Transfer Amount cannot contains “.” so 2 options:
the transfer amount is stocked in cent, just call it (102858)
the transfer amount is stocked with “.”, call it and multiply by 100 (1028.58 x 100)