How to handle TALER payments?

As I announced, I’m going to integrate the Taler payment system into Tryton. Taler will only be used of receiving customer payments and for refunding –at least for now. While technically this is not much of an issue, I discovered that I did not understand the sale, invoice and payment process well enough yet.

For the customer to be able to pay, Tryton needs to create an “Order” in Taler and then pass back an URL containing the “Order-ID” to the customer, e.g. by printing a QR-code on the invoice. For Tryton to get noticed about the payment, there are several methods: For offline payment (classic invoicing), Tryton would just poll Taler. For online payment (like a web-shop) the customer would be redirected to a URL, which is a Tryton route.

What I don’t get yet is: Where within the sale–invoice–payment process do I hook in creating the order, how do I hook in and how do I connect the payment with the sale/invoice.

  1. For a web-shop, I assume creating a route like account_payment_braintree.route.checkout() solves creating the Taler “Order”. as well as a Tryton “Receiving Payment”. After payment, another route can connect the Receiving Payment with the sale/cart and the invoice. I “just” need to store the Taler Order-ID with the sale/cart. Correct? Is there some example for this?

  2. For offline. payment, one creates a sale (optional) and an invoice. When the invoice is posted, a “Line to Pay” is created. anyhow. How to also create the Tryton “Receiving Payment” and the Taler “Order” here – which I need for printing the QR-code.

Thanks for any input in advance

You should probably use the account_payment module to declare the intento to create a payment in taller. This is the base model that use the other payments gateways like Stripe or Banktree.

You can extend this model in your TALER integration module by including the required fields to create the “Payment order” into the TALER API.

If you want to relate the payments into sale orders there is the sale_payment module which adds a link between payments and sales, so tryton can initiate the payment before confirming the sale. This is the workflow used normally by web-shops.

If you want to link payments into invoices, you can use the line field of the payments, which links to a receivable account move line which is created by an invoice. This way you get the link with the invoice.

Do not know so much about the TALER workflow nor you posted any link to it. But if you need to print a QR-Code in order to do the payment (which I guess its an URL), that should be the responsability of the account.payment model. Latter on, you can create a route which acks as webhook, so when taler receives the payment it posts the status to the route and the payment is updated into tryton. This is the workflow used on account_payment_stripe.

Hope that helps!