Click the custom plan section button and redirect to the payment page

I made a custom plan page. There are plans available on this page and when one of these plans is clicked. I want to redirect to payment page. I want to do this with this code

export function platiniumButton_click(event) {
wixLocation.to('/membership/payment/eyJpbnRlZ3JhdGlvbkRhdGEiOnt9LCJwbGFuSWQiOiJkYTJlMDg0ZS05NjBiLTQ3ZWUtODhjYy1iYjRlYzFiMTAwODUifQ')
 }

The question is i am not giving this url dynamically. Will the payment/eyJp… part change in the future? Is this id something changable? if the id is not something changable i will give this url statically. I’m open to your ideas if there is another sensible way. Thanks.

Have you taken a look at purchasePlan() method in wix-paid-plans API ?

It is not dynamic (and never), so please try the approach by @bwprado

Yes you are right but I think this function opens a small payment lightbox. I don’t want this. What I want is to redirect to the payment page. There’s something similar on wishlist, but I guess it doesn’t look like it will be done anytime soon. https://www.wix.com/velo/requested-feature/a-way-to-create-a-custom-checkout

Thanks.

I think I know what is the difficulty your facing. To create a custom checkout you need to manipulate the URL that is sent to the checkout page, I was able to do that on my Wix Stores site. I’ll take a look at a custom plan page to see how it works and help you figure it out.