How to set up Ifthenpay on Moloni ON

Learn how to set up Ifthenpay on Moloni ON to receive payments via Multibanco and PayByLink, automatically generate receipts, and add payment details to your documents.

What is Ifthenpay and what is it used for?

Ifthenpay is a Portuguese Payment Institution, authorised to operate within the European Economic Area (EEA) and directly supervised by the Banco de Portugal. As one of the first national Fintechs, it specialises in developing and integrating digital payment solutions for businesses.

Ifthenpay helps companies receive payments securely and automatically, 24 hours a day. Its main purpose is to allow any business (B2C or B2B) to integrate the most widely used payment methods in Portugal - such as Multibanco Reference, MB WAY, Credit Cards, and PAYSHOP - into their invoices, accounting documents, or e-commerce platforms.

Through this integration with Moloni ON, your business gains the ability to automatically issue references and payment links (PayByLink) directly within the documents sent to customers. It also provides real-time communication whenever a payment is made.


Follow these steps:

1. Access Settings on the left menu of Moloni ON, click Other settings, and select Payment gateways.

Moloni ON side menu open with Settings, Other settings and Payment gateways highlighted

2. Review the available options on the page and, if you do not have an account or contract yet, open the Ifthenpay registration form through the link inside your desired method.

Ifthenpay: PayByLink card on the Payment gateways page with the registration form link highlighted

3. Fill in the mandatory fields on the form and click Enviar. Once your details are submitted, the process with Ifthenpay will begin. As soon as it is complete, you will receive an email with the login details for the contracted services.

Ifthenpay registration form filled in with the Enviar button highlighted

4. Return to Moloni ON and click the Activate button.

Ifthenpay: PayByLink card on the Payment gateways page with the Activate button highlighted

5. In the Title field, enter an identifying name for this configuration (e.g., "Ifthenpay Multibanco").

Payment gateway form with the Title field highlighted

6. Enter the service key provided by Ifthenpay in the email into the MB key/gatewayKey field.

Payment gateway form with the MB key/gatewayKey field highlighted

7. Enable the Default option if you want this to be the standard payment method suggested on your Moloni ON documents.

Payment gateway form with the Default option highlighted

8. Click the Save button (in the top or bottom right corner) to get your anti-phishing key and activate the automatic Callback for real-time payment recording.

Payment gateway form with the Save button highlighted and the Callback link blurred

How do I generate receipts automatically on Moloni ON?

For Moloni ON to generate receipts 100% automatically, you must connect Ifthenpay's real-time communication mechanism (called Callback). Whenever a customer pays an invoice, Ifthenpay instantly notifies Moloni ON via this link, closing the invoice and issuing the receipt without manual intervention.


Follow these steps:

1. Access Settings on the left menu of Moloni ON, click Other settings, and select Payment gateways.

Moloni ON side menu open with Settings, Other settings and Payment gateways highlighted

2. Under Active gateways, click View details on the block of the Ifthenpay method you wish to configure (e.g., Ifthenpay: PayByLink or Ifthenpay: Multibanco).

Ifthenpay block under Active gateways with the View details button highlighted

3. Copy the link that appears in the Callback field and also save your Anti-phishing key generated by the system.

Payment gateway settings with the Callback field and the Anti-phishing key highlighted

4. Access your Ifthenpay customer portal. In the left side menu, click Administração and select Contrato/Contas.

Ifthenpay customer portal with Administração and Contrato/Contas highlighted in the side menu

5. Identify the relevant account in the table and, in the Opções column, click the link/chain icon (Callback activation).

Ifthenpay Contrato/Contas table with the Callback activation icon highlighted in the Opções column

6. Paste the link you copied from Moloni ON into the URL de Callback field.

Ifthenpay URL de Callback field with the link from Moloni ON pasted

7. Enter your security key into the Chave Anti-phishing field.

Chave Anti-phishing field highlighted in the Ifthenpay portal

8. Fill in the Chave de Backoffice field with the key provided directly by Ifthenpay, and click Aplicar to save the connection.

Chave de Backoffice field filled in with the Aplicar button highlighted

9. Return to the method settings page in Moloni ON and select the Optional settings tab at the top of the screen.

Optional settings tab highlighted at the top of the payment gateway screen

10. Enable the Automatically generate receipts option.

Automatically generate receipts option enabled under Optional settings

11. In the Document set field, select the document set from the drop-down menu where you want your receipts to be issued.

Document set drop-down menu open with the available document sets

12. In the Payment method field, select your preferred method.

Payment method drop-down menu open with the available options

13. Click the Save button in the bottom right corner to complete the process.

Completed optional settings with the Save button highlighted in the bottom right corner

How do I add payment details to a document?

To simplify the collection process and automate financial management, Moloni ON allows you to integrate payment gateways directly into your documents. When you activate this option, the system automatically generates the payment details associated with your configured financial entity - Multibanco references or direct links (PayByLink) - allowing your customer to pay with total convenience.

However, there are specific rules regarding where and when you can use this feature in Moloni ON. Make sure you meet the following requirements:

  • Eligible documents: Payment details can only be added to Invoices and Recurring Agreements. They are not available for other document types.
  • Workflow flexibility: You can include the payment right at the time of issuance or add it later to a document that has already been closed.

During the creation of a document


If you are issuing a new invoice or recurring agreement and want the customer to receive the payment link straight away, follow these steps:

1. After filling in the Commercial information and Products, go to the Generate payment data section and select your desired payment gateway.

Generate payment data section of an invoice with the gateway selector still empty

2. In the Value field, enter the exact amount to be charged through the gateway.

Value field filled in within the Generate payment data section of an invoice

3. Click Save and finish in the bottom right corner. Moloni ON will issue the document and immediately create the link or the reference in the Payments tab with a Pending status.

Save and finish button highlighted in the bottom right corner of an invoice

On an already issued document


If the document has already been generated without payment details and you want to add the link now, follow these steps:

1. Open the desired invoice or recurring agreement and click the Payments tab.

Issued invoice in Moloni ON with the Payments tab highlighted

2. Click the Generate payment button in the top right corner of the tab.

Payments tab of an invoice with the Generate payment button highlighted

3. In the Generate payment data section, select your desired payment gateway.

Generate payment window with the payment gateway selector highlighted

4. In the Value field, enter the amount to charge. You can use the total outstanding amount of the document, shown under Total value. Validate the details and click the Generate payment button to create the corresponding payment link or reference.

Completed Generate payment window with the Generate payment button highlighted

Status automation

As soon as the document is paid by the customer via the link or the reference, the status in the Payments tab automatically changes from Pending to Paid (with Callback active).