Why isn't my 'Buy it now' button working on my product page?

Hi!
I am adding a page template in Shopify to showcase my products.
I want to add a “Buy it now” button to this screen and have implemented it with the following code.

{% for product in collections.all.products %}
  {% if product.id == 'aaa' %}
    {% form 'product', product %}
      {{ form | payment_button }}
    {% endform %}
  {% endif %}
{% endfor %}

The button appears, but when I click on it, I get an error like the one in the screenshot.
Why is this happening?

Hi, @daiki44
Can you share the store URL

@Huptech-Web

Thank you for your response!

Sorry, but the store is not yet open to the public and cannot be accessed.

The button is working on a non-customized Shopify product page.

Hi @daiki44
You can share the password-protected page URL with the password so I can check if the store has any errors. I don’t want the store login credentials. without the URL I’m not able to assist you.

@Huptech-Web

Thank you for your kind attention.
I will send you the information by message!

Hi @daiki44
The product id fetched was wrong. That’s why the checkout is not working. you need to add the default variant id of that product.
The second thing is the store is currently password-protected that’s why the checkout is showing an error.

Hi @daiki44
Can you please check this code


@Huptech-Web

Thank you for your response!
I added the code you gave me, but nothing showed up…

Please see the URL I sent you in my message.

Hi @daiki44

I have tried this on my test store and found the same issue. but I have a solution for this also. You can use a featured product section here, Select the product you want to add to the cart then hide all the things like image, title, price, etc but not the Buy Now button.
In this way, it is possible to add a buy now button.
I have tested this method on my test store and it is working.

@Huptech-Web

Thank you for trying it!

I added the following code you provided and the button did not seem to display.

{{ form | payment_button }}

Please let me know if there is another way to display the payment button on the custom page.

Hi @daiki44
I have mentioned the method in the previous message you can try → https://community.shopify.com/c/payments-shipping-and/payment-button-does-not-work/m-p/2371810/highlight/true#M81853

Hi @Huptech-Web
Thank you for your reply!

I’m sorry. I could not understand what you said in your previous message.

Would it be possible for you to give us the specific code?‍

I do not have the image of how to add a PaymentButton to a customized page in what you gave me.