What payment gateway should be used for invoice payment? My Drupal commerce site supports multiple payment gateways. One of the payment types should be paying by invoice. That means if you select invoice payment type during checkout process you don't have to enter any &quot;real&quot; payment info (credit card data or something), but at end site should send you invoice (pdf document) with instructions how to pay your order.
I've installed Invoice module: https://www.drupal.org/project/commerce_invoice
And if I understood well I should use actions and rules to send email after checkout is complete. Is that true?
But what puzzles me most is that this module doesn't provide invoice payment gateway. So I don't know how to achieve that when user is selecting payment method &quot;Pay by invoice&quot; method appears? Should I use some dummy (test) payment gateway or? What payment gateway should be used for invoice payment?
An update:
What Rules event should I use to detect that checkout process is finished, so I can send invoice.
Also, what action should I select to send email that contains invoice (with link to PDF document or PDF document attached)?
Yes - just create a new (custom, standard) payment method named Invoice, and user's then can select that.
On the payment method edit form you can add more details, and even could limit the availability of the method.
Rules are not actively supported as in D7: https://www.drupal.org/node/1535554
But I do not see a need using rules with your use-case.
You need to configure your invoice type to send emails, there should be a checkbox: Email the customer a confirmation when an invoice is generated - see https://www.drupal.org/project/commerce_invoice/issues/3089861
The invoice is attached by default and you can remove the attachment with hook_mail_alter, it's using the id invoice_confirmation. See https://git.drupalcode.org/project/commerce_invoice/-/blob/8.x-2.x/src/Mail/InvoiceConfirmationMail.php (UPDATE: The invoice types seem to create invoices for all payment methods and is not (yet) configurable to limit them)
See also the commerce-invoice-confirmation.html.twig to change the email.
Not attaching the PDF makes the emails smaller, and maybe passes more SPAM filters .. But users need to take action and press a link .. I would discuss that with the customer or maybe try both and gain experience with them. (Like what method is really paid more, and which one is faster)
UPDATE:
If you only want to send the invoice for one payment method you need to alter the commerce receipt email (id: order_receipt) and attach the invoice there. You'll find the order entity in the body's theme render array (first entry using #theme commerce_order_receipt)