How to create a webshop integration


Rasmus Nielsen,

In this guide we will look at how to create a solid webshop integration with Dinero. This guide will assume that you create invoices on your own end and not through our invoicing system.

First let’s get an overview of what we want to accomplish, when you handle the invoices on your end.

Create a deposit to handle creditcard receivables. Book invoices Book payouts, if we can handle this

And that’s it. Quite simple actually when you break it down. Let’s look at how we’ll handle this.

Setup

For accounting purposes we need to place credit card payments on a deposit belonging to the payment provider. This deposit account could be named “Credit Card Receivables” or named after the specific payment provider for instance “Flatpay” or “Stripe”. We need to park the payments here, since they are usually paid out in bulk at a later date.

To create a deposit account, you’ll use the following endpoint:

POST Create deposit account

Number should be in the 55000-55999 range. We have some standard accounts in this range you need to avoid. Something like 55120, 55125 etc. will usually be safe to use. However the user can create their own accounts in our system and these numbers might already be used. Be ready to handle these situations, by for instance adding 5 to the account number, in case it’s already used.

Account information such as bank registration and bank account number can be left empty, since this is not a bank account.

The user might have several bank accounts in their actual bank and that needs to be represented in their accounting. So in case you handle payouts, make sure to let the user define which bank account to book payouts to.

55000 is the default bank account everyone will have. 55040 is the default cash account everyone will have. 55120 will be created as a creditcard deposit and used as part of this walk through.

Booking invoices

We will book every invoice manually into Dinero to make sure we don’t end up in a conflict with invoice numbers, in case the user also manually invoices from Dinero.

First we need to upload the just created invoice to Dinero:

POST Upload File

Next we’ll book the invoice into the accounts. We’ll create something along the lines of the following simple request:

POST Create Manual Voucher

We fill it out as follows, make sure to use the same account and balancing account as shown here and have the amount in negative. This is due to the debit/credit principle. The amount should be the invoice total.

{
  "voucherDate": "yyyy-mm-dd",
  "lines": [
    {
      "description": "Faktura nr. X d. dd/mm/yyyy",
      "accountNumber": 1000,
      “balancingAccountNumber”: 55120,
      "amount": -1000,00
    }
  ],
  "fileGuid": "{The guid of the file we just uploaded}", 
  "externalReference": "e.g. Webshop ID:42 (for your use)"
}

Finally make sure to book the manual voucher invoice:

POST Book Manual Voucher

And this is basically it, quite simple. If you don’t handle or know anything about when the user is paid in bulk, then you can skip the next step.

Booking payouts

Our demo webshop integration also handles payouts.

First we will upload another file, showing the payout and the fee involved. I assume the fee is VAT free, since most payment fees are without VAT, if your fee is with VAT you need to tweak it with a Vat Code.

POST Upload File

There is a 3% cut of all that is received via card. We book this as a fee. Our voucher will look like this:

POST Create Manual Voucher

{
  "voucherDate": "yyyy-mm-dd",
  "lines": [
    {
      "description": "Udbetaling fra indløser d. dd/mm/yyyy",
      "accountNumber": 55000,
      "amount": 970,00
    },
{
      "description": "Kreditkort fra indløser d. dd/mm/yyyy",
      "accountNumber": 55120,
      "amount": -1000,00
    },
{
      "description": "Gebyr fra indløser d. dd/mm/yyyy",
      "accountNumber": 7220,
      "amount": 30,00
    }
  ],
  "fileGuid": "{The guid of the file we just uploaded}", 
  "externalReference": "e.g. Webshop ID:43 (for your use)"
}

Once again, remember to book this voucher once it has been sent over.

POST Book Manual Voucher

Any other service fees

If you charge for your service, say once a month, you can also automate this booking. This is simply done via our purchase voucher, which is quite intuitive.

POST Create Purchase Voucher

You simply fill out any applicable fields, usually a cash purchase since it’s withdrawn at the same time as the date on the invoice from you, and book it into the Software account, 7320, with the amount charged. Remember to upload a file as before, and book this once it’s been sent over. This account assumes you charge Danish VAT on your service.

And with that you’re done. Congratulations, you now have a pretty good Webshop integration with Dinero.



If you want to be notified whenever we have news, you can add this news feed to your favorite RSS feed software.

Get started today!

Documentation