The answer to this will depend on how you’re collecting payments, but the overall concept is the same. Your payment gateway (WooCommerce, ThriveCart, Spiffy, etc.) will send the user details to ActiveCampaign and create a record in there for them. The payment system should also apply a tag which will, in turn, trigger an automation.
In that automation, you’ll use a Memberium for ActiveCampaign webhook. This webhook will add your users into WordPress and generate passwords for them if they don’t already have one.