My Office 365 trial is almost up and I want to convert it to a paid subscription. Can I do this online?

Assuming you are an administrator on your trial account, yes. You simply need to go to the Office 365 portal and select the grey tile labeled admin.

You will see purchase services on the left side of the page. Click there and scroll through the available plan options until you find the one you need. Then just walk through the checkout process.