An error occurred while saving the commentMax commented
Hello, thanks for the feedback, I didn't realize emails where not sent with that method.
Regarding my implementation: since we are using the existing WA invoice & payment screens I ended up adding some Global JS that will look for PayPal payment buttons and replace them with a custom pay button.
The button will grab the invoice "document number" on the page and redirect to our payment page. It only works for screens that have that document number on it though, so the one in the profile/invoice section. Other payment buttons were changed to redirect to the profile section so user can click on pay there.
Our payment page is on WordPress (as the rest of the website) so we can leverage the WordPress SSO plugin to get the current WA user. From there we use the admin API and look for all the outstanding invoices for that customer searching for the document number (invoice id != document number).
Once we have the invoice we display it on the payment page, and we use a local payment gateway (similar to Stripe) to collect credit card payments (and to remember credit card info). Once it's paid we use the admin API again to record a payment for the invoice.
It does work but that's a lot of moving parts.