Shopify orders invoiced and booked in sevdesk
Each new Shopify order becomes a sevdesk invoice, emailed to the buyer. The matching Stripe payment is then booked against it, so the invoice is marked paid.
The prompt
When a new order comes in on our Shopify store, find the buyer in sevdesk by their Shopify customer ID, which we keep in a contact custom field. If they aren't there yet, create them as a customer with the next customer number and save the Shopify ID on the contact. Check which bookkeeping version our sevdesk account runs, then create an invoice with the order's lines and shipping and email it to the buyer from sevdesk. After that, look in Stripe for the payment with the same amount for that order or from that buyer, and if it's there, book it against the invoice on our Stripe account in sevdesk. If there's no payment yet, leave the invoice open.
FlowRunner Prompt to Flow built this flow from that request. Here it is as it opens in the editor.
The flow
Download the file, then in FlowRunner click + beside Flows, pick it under Import a Flow Version and click Create. How importing works
What each step does
- New Shopify order Checks your Shopify store every 5 minutes for new orders and reads each one in full: lines, shipping, tax, buyer and billing address.
- Read the sevdesk setup Reads the account's bookkeeping version, users, countries, contact custom fields and check accounts, so the invoice carries the tax rule or tax type that version expects.
- Find the buyer in sevdesk Looks the buyer up by their Shopify customer ID, kept in a contact custom field, instead of matching on name.
- Create the buyer A buyer who isn't in sevdesk yet becomes a customer with the next free customer number, and the Shopify ID is saved on the contact for the next order.
- Create the invoice Creates the invoice with one line per item, a shipping line and the VAT rate Shopify charged on each line, addressed to the billing address and marked with the Shopify order number.
- Email the invoice sevdesk emails the invoice to the buyer, which also marks it as sent.
- Match the Stripe payment Looks through recent Stripe payments for one that succeeded with the same amount and currency and names the order or the buyer's email.
- Book the payment Books the payment against the invoice on your Stripe check account in sevdesk, with the Stripe amount and date, which marks it paid. With no payment yet, the invoice stays open.
Before you turn it on
- Enter your sevdesk API token, your Shopify store domain, and your Stripe secret key and client ID, and connect your Shopify and Stripe accounts.
- In sevdesk, create a contact custom field for the buyer's Shopify customer ID, for example Shopify customer, and put its name in the flow setting Shopify ID field in sevdesk.
- Keep a check account in sevdesk for Stripe payments, such as a clearing account, and put its name in the flow setting Stripe account in sevdesk.
- Put the sevdesk tax rule your sales fall under in the flow setting sevdesk tax rule, for example 1 for taxable sales in Germany.