The below function can be used to create a quick checkout link that bring the customer straight to checkout populated with the product variant and selling plan provided.
Here is an example of using this with a button element. The variant id and selling plan id are pulled from the add to cart form when the button is clicked so the magic link is dynamically based on the most most recently selected values.