Skip to content

Payment to invoice

When money arrives through a payment provider, somebody still has to raise the invoice, mark it paid and send the receipt. This workflow does it the moment the provider reports the payment.

The Payment to invoice workflow on the canvas: Payment webhook, then Find the payer, then Create invoice, then Mark it paid, then Email receipt, then Log the payment

Before you start

  • A payment provider that can send a webhook when a payment succeeds, such as Stripe
  • An invoice layout in BaseCloud

The workflow

Step Task Type What it does
1 Payment webhook Webhook In Receives the payment notification
2 Find the payer Match to Client(s) Finds the client by the payer’s email address
3 Create invoice Accounting Creates the invoice for the amount paid
4 Mark it paid Accounting Records the payment on that invoice, for the amount paid
5 Email receipt Email Emails the client a link to the paid invoice
6 Log the payment Workflow Note Records the payment on the client

About the variables

Values such as {{task_36611_…}} carry the number of the task they come from, so yours will differ. Do not type them: click into a field and pick the value from an earlier task.

1. Payment webhook

Task: Webhook In. Receives the payment notification.

Field Set it to
Response Type Immediate
Response Body {"received": true}

Copy this task’s webhook address into your payment provider. The variable names follow the fields the provider sends.

2. Find the payer

Task: Match to Client(s). Finds the client by the payer’s email address.

Field Set it to
Action Match to Client
Find the client by Contact email = {{task_36611_customer_email}}

3. Create invoice

Task: Accounting. Creates the invoice for the amount paid.

The Accounting task named Create invoice, opened to its settings

Field Set it to
Action Create Invoice
Invoice Layout 752
Client ID {{task_36612_match_client_id}}
Item Description(s) {{task_36611_description}}
Item Code(s) ONLINE
Item Quantity(ies) 1
Unit Cost(s) {{task_36611_amount}}
Tax Rate(s) 0

4. Mark it paid

Task: Accounting. Records the payment on that invoice, for the amount paid.

Field Set it to
Action Mark Quote / Invoice Paid
Quote / Invoice ID {{task_36613_quote_invoice_o_id_full}}
Date paid Leave it blank
Amount {{task_36611_amount}}
Keep anything above the balance as credit Yes
How it was paid Card
Reference {{task_36611_payment_id}}

Quote / Invoice ID takes the invoice's number (INV1025), not BaseCloud's internal ID. Leave Date paid blank for today, in your business's timezone; a word such as today isn't a date and stops the run.

Amount records what the provider actually took. If it's less than the invoice, the invoice is part paid. If the client already had credit, the new invoice used some of it, so the payment is more than the invoice still owes: Keep anything above the balance as credit set to Yes keeps the rest as the client's credit. Left on No, only what the invoice owed is recorded, and a note on the client says how much was left out.

The Reference keeps the provider's payment ID on the payment, so you can find it later, and it means a webhook the provider sends twice never records the payment twice.

If the client's credit paid the whole invoice, the task records nothing (already_paid is true). Add an If Statement on {{task_36614_already_paid}} to leave accounts a note when that happens.

5. Email receipt

Task: Email. Emails the client a link to the paid invoice.

Field Set it to
Outgoing Email User Wendy Darling
Client {{task_36612_match_client_id}}
To {{task_36611_customer_email}}
Subject Your receipt: invoice {{task_36613_quote_invoice_o_id_full}}

Body

Hi,

Thank you for your payment of ${{task_36611_amount}}.

Your paid invoice is here: {{task_36613_document_url}}

Kind regards,
Accounts

6. Log the payment

Task: Workflow Note. Records the payment on the client.

Field Set it to
Action Create Note
Client ID {{task_36612_match_client_id}}
Note Type Note
Priority Low
Due Date Now
Tag Users Tiger Lily
Mark above users as Done

Message

Online payment of ${{task_36611_amount}} received. Invoice {{task_36613_quote_invoice_o_id_full}} created, marked paid and emailed.

Make it yours

  • Add a Create New client task for payers who are not clients yet.
  • Use the field names your provider sends. Stripe's payment ID, for example, is in the webhook's data.
  • Change the item description and code to match your Pricebook. With your books on, use a code that names one of your income accounts, such as 4000.
  • Taking payments through BaseCloud's own payment link instead? Then you don't need this workflow: the payment is recorded on the invoice by itself.