How do you think I could improve it?
You're already off to a good start, but if you want to have full control over those funds, then you might want to consider using a self-hosted processor
[e.g. BTCPay Server] as opposed to a custodial one
[e.g. Coinbase].
Take note: Most of the self-hosted processors are a bit more complicated and that includes the conversion part as well; In other words, just ignore my suggestion if you're after an automated process.
You can find most of the other processors in the following link:
Awesome Bitcoin Payment Processors