The point of setting up a system is accounting for arbitrary pricing, especially for a donation system. Keep in mind that OP isn’t the only one looking at this post. Variation can be anything, from a few to a lot. It’s better to just set up a set amount of products that you can incrementally prompt until the total is reached instead of trying to handle things like this.
As for the API - just because it’s public and documented, doesn’t mean that all uses cases of it are permitted. Saying “it’s public so it’s allowed” is bad justification and insufficient citation for making a judgement call about what engineering or moderation thinks about how you use the API.