Hi everyone,
I'm absolutely thrilled that there's amazing open source packages like cashier-stripe out there, however for my implementation I'm in a situation where I'm not sure what the best way forward is, with Cashier.
I have a multi-tenancy application where each "user" can be part of multiple tenants, so their stripe_id is stored in a link table per tenant, meaning the "stripe_id" column remains empty.
This all works fine, except for webhooks, where Cashier's static function "findBillable" is using a query on that column to find the billable object. This is where my conundrum lies, as I have a couple of options:
- work with 1 stripe_id -> not possible
- capture the where() function on the User model, specifically for the use case in the findBillable static method -> i feel like that's way too much of a hack and does not provide certainty other methods in Cashier (or future methods) will work as well
- override the static function Cashier::findBillable -> so far, I believe this is not possible in PHP
- make a fork of Cashier to alter this function
Currently I'm going with the last option, although it feels like overkill, it does feel like the most clean option going forward.
If anyone has insights on how to tackle this, any feedback would be very much appreciated.