Answers.Body: <p>You want to look at Commerce's 'manual' gateway.</p>
  <p>This is a gateway that let's you receive unpaid orders, which you can then process as you see fit, including manually 'capturing' the payment when it is ultimately made.</p>
  <p>We use this to e.g. offer a mechanism for people to pay by direct bank deposit - we just leave the orders in a 'holding' status until the payment comes in, then we 'capture' the payment on the transaction tab in the order, and process as normal from there.  But you could also process and send the order with an invoice of course.</p>
  <p>Both the order processing flow and front end implementation are really entirely up to you, but the key is this gateway will accept the order without payment.</p>
  <p>Here's our set up (in the Commerce -&gt; System Settings -&gt; Gateways area) as an example.  Note the labelling here isn't great (where it says 'Credit Card Payment Type' can lead you to think you can only use this with cards, which is not the case at all...) - but it does what you want.</p>
  <p><a href="https://i.sstatic.net/XxjIt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XxjIt.png" alt="enter image description here" /></a></p>
  <p>Note the documentation for this is here:</p>
  <p><a href="https://craftcms.com/docs/commerce/3.x/payment-gateways.html#manual-gateway" rel="nofollow noreferrer">https://craftcms.com/docs/commerce/3.x/payment-gateways.html#manual-gateway</a></p>
  <p>(...would be good to see that expanded with some practical examples, though)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-26T06:17:23.743Z
Answers.Text: Thanks for the hint. What i don't find is a way to access the gateway: this does not work: '{% if cart.gatewayId == 4 %}'. 
  
  In my theory i would check which gateway and then redirect to another payment.twig without this {{ actionInput('commerce/payments/pay') }}. 
  Or a second option inside payment.twig i check which gateway and then do not apply 'actionInput('commerce/payments/pay') }}'.
Answers.UserDisplayName: Henrik
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-27T10:40:02.917Z
Answers.Text: You still submit to `commerce/payments/pay` (with the gatewayId set to your configured manual gateway) - which will then complete/accept the order, but leave it as unpaid.
Answers.UserDisplayName: Jeremy Daalder
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-24T23:44:51.850Z
Answers.LastActivityDate: 2021-07-25T23:50:53.580Z
Answers.LastEditDate: 2021-07-25T23:50:53.580Z
Answers.UserDisplayName: Jeremy Daalder
Answers.Body: <p>This is working for me, there might be a better solution:</p>
  <p>i get the id from the manual payment gateway (thanks jeremy),
  set it and if its this manual gateway i make the order without payment.
  <a href="https://craftcms.com/docs/commerce/3.x/making-payments.html#checkout-without-payment" rel="nofollow noreferrer">https://craftcms.com/docs/commerce/3.x/making-payments.html#checkout-without-payment</a></p>
  <p>otherwise go ahead with the normal process.
  i put this all in the payment.twig</p>
  <pre><code> {% set id = 4 %}
   {% if id == cart.gatewayId %}            
     {{ hiddenInput('action', 'commerce/cart/complete') }}
     {{ redirectInput('/shop/customer/order?number='~cart.number~'&amp;success=true') }}
   {% else %}
      {{ actionInput('commerce/payments/pay') }}
      {{ redirectInput(siteUrl('shop/customer/order', { number: cart.number, success: 'true' })) }}
      {{ hiddenInput('cancelUrl', siteUrl('shop/checkout/payment')|hash) }}
   {% endif %}
  </code></pre>
  <p>i also added a commerce.php file in the config folder and added this:</p>
  <pre><code>'allowCheckoutWithoutPayment' =&gt; true,
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-28T11:34:54.633Z
Answers.Text: Not quite sure what is the point of your extra logic/config?  If you just submit to the normal payment controller (which will allow an order without payment to be completed with the manual gateway anyway) ... there will be less logic to think about/maintain, and an identical result...(assuming this way doesn't mark the order as paid, which I infer from the docs it might...which strikes me as bad - surely you _want_ the order to be completed but NOT marked paid, so that you know what's going on with the order in the back end when processing it?
Answers.UserDisplayName: Jeremy Daalder
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-28T15:46:31.007Z
Answers.Text: you are right. i tested it without my logic and it works. dont know, why it did not work in the first place. i will edit my answer. but i can use the if logic, to alter the text of the submit button (from "pay order", to "send order"). But 1 questions remains: what is then the config "allowCheckoutWithoutPayment" for?
Answers.UserDisplayName: Henrik
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-28T22:09:50.540Z
Answers.Text: I'm not 100% sure but my _guess_ is that the config item allows for an order (without payment) to appear as completed AND paid, in the backend, whereas the approach I showed above makes the order complete but it is NOT paid (which is, I'd think, what most people want).  But I could be wrong, I haven't tried the other way.  Be easy for you to check though.  Just look at the order status stuff in the control panel with each approach.
Answers.UserDisplayName: Jeremy Daalder
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-28T22:11:10.030Z
Answers.Text: (That's how I interpret the warning on the page `If you enable order completion without payment, completed orders will have the same status as any others. Don’t forget to make sure store managers are aware of the change and prepared to confirm payment before fulfilling orders!` - but it could be more explicit about what it actually means by same status...
Answers.UserDisplayName: Jeremy Daalder
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-27T14:08:57.453Z
Answers.LastActivityDate: 2021-07-27T14:08:57.453Z
Answers.UserDisplayName: Henrik
Body: <p>I am using the Craft Commerce templates as a starter, haven't altered that much yet.</p>
  <p>On the payment-method page, I have a gateway for credit card/Paypal, etc. via a plugin, which works fine.</p>
  <p>I would like a second option, where the customer can make the order without paying,
  but will receive a physical invoice together with the post-package.</p>
  <p>I guess this would mean, if the user clicks this additional option (on the payment-method page, the possible gateways are displayed as different radio options),
  they get redirected to a different payment.twig page, where they can finish the order without paying. (or alter the payment.twig page in some way)</p>
  <p>I was searching, but could not find anything in this direction.</p>
  
Tags: <plugin-craftcommerce><payment-methods>
Title: Adding second option on payment-method (buying without paying, getting physical invoice with order (pay on account))
ThreadText: # Adding second option on payment-method (buying without paying, getting physical invoice with order (pay on account))
  
  (Asked by: username_0 on 2021-07-23)
  
  I am using the Craft Commerce templates as a starter, haven't altered that much yet.
  
  On the payment-method page, I have a gateway for credit card/Paypal, etc. via a plugin, which works fine.
  
  I would like a second option, where the customer can make the order without paying,
  but will receive a physical invoice together with the post-package.
  
  I guess this would mean, if the user clicks this additional option (on the payment-method page, the possible gateways are displayed as different radio options),
  they get redirected to a different payment.twig page, where they can finish the order without paying. (or alter the payment.twig page in some way)
  
  I was searching, but could not find anything in this direction.
  
  **Tags:** plugin-craftcommerce, payment-methods
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2021-07-24. Score: 2 | Accepted answer
  
  You want to look at Commerce's 'manual' gateway.
  
  This is a gateway that let's you receive unpaid orders, which you can then process as you see fit, including manually 'capturing' the payment when it is ultimately made.
  
  We use this to e.g. offer a mechanism for people to pay by direct bank deposit - we just leave the orders in a 'holding' status until the payment comes in, then we 'capture' the payment on the transaction tab in the order, and process as normal from there. But you could also process and send the order with an invoice of course.
  
  Both the order processing flow and front end implementation are really entirely up to you, but the key is this gateway will accept the order without payment.
  
  Here's our set up (in the Commerce -> System Settings -> Gateways area) as an example. Note the labelling here isn't great (where it says 'Credit Card Payment Type' can lead you to think you can only use this with cards, which is not the case at all...) - but it does what you want.
  
  [![enter image description here](https://i.sstatic.net/XxjIt.png)](https://i.sstatic.net/XxjIt.png)
  
  Note the documentation for this is here:
  
  <https://craftcms.com/docs/commerce/3.x/payment-gateways.html#manual-gateway>
  
  (...would be good to see that expanded with some practical examples, though)
  
  > **Comments:**
  > **username_0**: Thanks for the hint. What i don't find is a way to access the gateway: this does not work: '{% if cart.gatewayId == 4 %}'.   In my theory i would check which gateway and then redirect to another payment.twig without this {{ actionInput('commerce/payments/pay') }}.  Or a second option inside payment.twig i check which gateway and then do not apply 'actionInput('commerce/payments/pay') }}'.  
  > **username_1**: You still submit to `commerce/payments/pay` (with the gatewayId set to your configured manual gateway) - which will then complete/accept the order, but leave it as unpaid.  
  
  ---
  
  ### Answer by username_0 on 2021-07-27. Score: 0
  
  This is working for me, there might be a better solution:
  
  i get the id from the manual payment gateway (thanks username_1),
  set it and if its this manual gateway i make the order without payment.
  <https://craftcms.com/docs/commerce/3.x/making-payments.html#checkout-without-payment>
  
  otherwise go ahead with the normal process.
  i put this all in the payment.twig
  
  ```
   {% set id = 4 %}
   {% if id == cart.gatewayId %}            
     {{ hiddenInput('action', 'commerce/cart/complete') }}
     {{ redirectInput('/shop/customer/order?number='~cart.number~'&success=true') }}
   {% else %}
      {{ actionInput('commerce/payments/pay') }}
      {{ redirectInput(siteUrl('shop/customer/order', { number: cart.number, success: 'true' })) }}
      {{ hiddenInput('cancelUrl', siteUrl('shop/checkout/payment')|hash) }}
   {% endif %}
  
  ```
  
  i also added a commerce.php file in the config folder and added this:
  
  ```
  'allowCheckoutWithoutPayment' => true,
  
  ```
  
  > **Comments:**
  > **username_1**: Not quite sure what is the point of your extra logic/config?  If you just submit to the normal payment controller (which will allow an order without payment to be completed with the manual gateway anyway) ... there will be less logic to think about/maintain, and an identical result...(assuming this way doesn't mark the order as paid, which I infer from the docs it might...which strikes me as bad - surely you _want_ the order to be completed but NOT marked paid, so that you know what's going on with the order in the back end when processing it?  
  > **username_0**: you are right. i tested it without my logic and it works. dont know, why it did not work in the first place. i will edit my answer. but i can use the if logic, to alter the text of the submit button (from "pay order", to "send order"). But 1 questions remains: what is then the config "allowCheckoutWithoutPayment" for?  
  > **username_1**: I'm not 100% sure but my _guess_ is that the config item allows for an order (without payment) to appear as completed AND paid, in the backend, whereas the approach I showed above makes the order complete but it is NOT paid (which is, I'd think, what most people want).  But I could be wrong, I haven't tried the other way.  Be easy for you to check though.  Just look at the order status stuff in the control panel with each approach.  
  > **username_1**: (That's how I interpret the warning on the page `If you enable order completion without payment, completed orders will have the same status as any others. Don’t forget to make sure store managers are aware of the change and prepared to confirm payment before fulfilling orders!` - but it could be more explicit about what it actually means by same status...  
  
  ---
  
  