Creating a Taler payment for invoicing

I want customers to be able to pay an invoice by their choice using the GNU Taler payment system or bank transfer. For this the QR-code for the Payment-URL needs to go into the invoice report. This Payment-URL is created by a remote service (the merchant backend). The customer will then scan the QR-code and settle the payment with that remote service. (Well, this is much like e.g. Stripe works.)

I already implemented all the parts towards the remote service.

Anyhow, I’m missing one link: How to trigger creating a payment when creating an invoice? (Thus that Payment-URL can be put into the invoice.) And in which state transition to create it?

Any hints?

If I understand correctly, you want to call a remote service to get a payment QR code?

If so, when an invoice is posted, the different moves are created, also a number and date is added. So I think when posting the invoice you could also call the remote service to get the payment link. In the report you can convert that link into an QR-code or when you send the invoice by email, add that link in the email as well.

Thanks.
Yes, I want to call a remote service to get a payment QR code.

There seems to be no hook for this, isn’t it? I only found Invoive.…post(). OTOH, this is used in e.g. purchase.Invoice, so I assume overwriting is okay. Correct?

I do not think it is correct to create the payment in Tryton in advance without browning the customer will use this means to pay the invoice.
The problem is that once the payment is created in Tryton, the line to pay is not more considered as “to pay”. It will be out of the dunning process etc.

For me it will be better to provide a generic page for the invoice on which the customer can choose the method to pay the invoice. It will be only at this point that the payment will be created.
The existing account_payment modules have already each a checkout page which could be use to redirect the customer when he choose the corresponding method.

IC. Thanks for the explanation. (I’ve seen the checkout-pages in tehe other moduls and I already implemented one for Taler.)

Since I really like the idea of offering different payment methods even on invoices (which might be of interest for GNU Health in some countries):

  1. Would it be possible to remove the payment from the invoice, and would dunning, etc. then continue to work? (With Taler, die payment will fail “automatically” in case the customer did not pay in time.) Or does dunning etc. anyways kick in again if the payments failed?

  2. If the customer chooses to pay with bank transfer, I assume one can simply attach this payment with the invoice. (And either let the Taler payment time out or cancel it.) Could this work?