I'm having a very hard time making a one-page checkout. What I actually want is: automatically add the item to the cart. The cart can only contain one item. On the product page (that automatically adds the item to the cart) I want name and address fields and that's it. A pay button below that redirects to the payment gateway. This is what I have now, but the page keeps redirecting to the same page instead of going to the payment gateway.
{% set cart = craft.commerce.getCarts().getCart(true)%}
{% do cart.setLineItems([]) %}
{% set lineItem = craft.commerce.lineitems.resolveLineItem(cart.id, product.defaultVariant.id, [], 1, '') %}
{% do cart.addLineItem(lineItem) %}
<form method="POST">
<input type="hidden" name="action" value="commerce/payments/pay"/>
{{ redirectInput('/shop/customer/order?number='~cart.number) }}
<input type="hidden" name="cancelUrl" value="{{ '/shop/checkout/payment'|hash }}"/>
<input type="hidden" name="orderEmail" value="bart.rylant+ordermail@gmail.com"/>
{{ csrfInput() }}
<input type="text" name="shippingAddress[firstName]" value="dsfdsfsd">
<input type="text" name="shippingAddress[lastName]" value="sdfsdfsfsdfs">
<input type="hidden" name="shippingAddress[countryId]" value="166">
<input type="text" id="shippingAddress-address1" name="shippingAddress[address1]" value="straatnaam nummer">
<input type="text" id="shippingAddress-city" name="shippingAddress[city]" value="Gemeente">
<input type="text" id="shippingAddress-zipCode"name="shippingAddress[zipCode]" value="2910">
<input type="text" id="shippingAddress-phone" name="shippingAddress[phone]" value="4545546544654465">
<input type="email" id="email" name="email" value="testmailsdfsdfsd@gmail.com">
<input type="hidden" name="shippingMethodHandle" value="freeShipping">
<input type="hidden" id="paymentMethod" name="paymentMethod" value="gateway:2">
<input type="submit" value="Pay">
</form>