Step one is to fill in the monthly payout sheet. This is a list of all of the members who have reached the payout threshold.
If you don't have the scripts repo yet, clone it from here.
cd into the repo and then into /gen-payouts and run bun install to
install the dependencies.
Run the script:
bun run prod | pbcopy
This will copy a structured list of member payout data to your clipboard.
You'll need to paste this into
this Google Sheet
once pasted, select the whole column, then click Data > Split text to columns to have the formatted correctly (as shown in the video below (note that the video taps out at 5mins due to Loom timeout
but it's worth watching anyway before continuing with these docs)):
This is captured at the end of the video above but to detail it, head to the Payout Requests section of the Strapi admin.
Click the "Create new payout request" button in the top right to create new payout_request
objects for all valid members.
You should see that the number of new payout_request objects created matches the number
of valid members in the sheet.
Next you need to let Rupert know that the payout requests have been created and that the sheet is ready for his review.
Once you've got the thumbs up from Rupert that he has loaded the PayPal account with the correct amount you are clear to proceed.
Next you need to mark all of the payout_requests as approved.
This will let the Strapi know that these are the payout requests that are due to be processed.
The easiest way to do this is in TablePlus:
UPDATE payout_requests SET status = 'approved' WHERE status = 'pending';
You can read more about the payout_request model in
the Treasury docs if you're interested.
The payout requests will be processed by the GET /api/cron/process-payouts cron.
This is currently not set up to run as a cron and is called manually as part of this process.
Here is the link to the EasyCron dashboard.
Scroll down to the "Process Payouts (Production)" job and click the 🧑🔬 "Test cron job manually" button.
Manually poking this endpoint will trigger each payout request to be sent to PayPal to process.
Upon success, the user's PayPal account will be credited, and the funds will be moved from
the holding account to paid-out in the ledger. The Payout Request will then have its
status set to complete.
Send a message to Rupert and Joel via Slack to let them know that the payouts are been processed.
If any errors occur, they will be logged in the payout_request table and the response from PayPal is saved
in the metadata field. If any errors occur, they should be investigated and the details shared
with Rupert and Joel via Slack. They will decide how to action these errors and if communications
are required with the users.
Congratulations, you've just completed the Payout Party Flow! 🎉