Live verification. Verified live on a test company (2026-11-11) with this release: selling gift certificates (including automatic numbering, required barcodes and expiry), redeeming them with cash change, forfeit and a credit-note change, marking certificates used, activating the change credit note, the recovery commands, and the refusals before any write; every test invoice ended fully settled. Not exercised live: the reference lookup after a failed invoice create, because no create failed.
dkERP keeps gift certificates and credit notes as rows ("papers") of one table, SOPAPERS, told apart by the paper
type:
| Paper type | Meaning | Client model | Resource |
|---|---|---|---|
| 9 | Gift certificate | GiftCertificate |
client.Sales.GiftCertificate |
| 8 | Credit note (DK: claim note, "innleggsnóta") | CreditNote |
client.Sales.CreditNote |
A number can exist as both a gift certificate and a credit note, so every lookup keeps only the row of its own
type. Each paper has a record id (RecordId, the identifier you use for recovery), a Number, an optional
Barcode, an Amount, a validity period (ValidFrom, ValidTo; unset means no limit), a Customer, and the
invoice that issued it (SourceInvoiceRecordId, SourceInvoiceLine) and the invoice it was used on
(DestinationInvoiceRecordId, UsedOn).
A paper's Number and Barcode are bearer values: whoever has them can spend the paper. The client never logs them,
and error messages name record ids instead.
GiftCertificate.IsRedeemable(now) is true when the certificate is valid (IsValid == true), unused (no UsedOn and
no DestinationInvoiceRecordId), not past its last day (ValidTo is compared as a UTC date), and its status is not
inactive or used. Status 0 ("not defined") is accepted because dkERP leaves it on real rows, used certificates
included, so the other columns decide. A missing IsValid is not redeemable.
| Requirement | Used for | If missing |
|---|---|---|
| Papers are stored in dkERP, not in dkPos (retail setup storage = dkERP) | Everything that writes | NotSupportedException before any write |
| A gift-certificate payment method (payment type 9) | Redeeming | DkPlusModelValidationException before any write |
| An exchange payment method, "Til baka" (payment type 6) | Change in cash | DkPlusModelValidationException |
| A credit-note payment method (payment type 8) | Change as a credit note | DkPlusModelValidationException |
| An item flagged as a gift certificate in the item record | Selling | InvalidOperationException before any write |
| The retail setup settings below | Selling (numbers, barcodes, expiry) and your own change policy | A missing setting reads as 0 |
You always supply the payment ids. The client never picks a payment method for you, but it checks your ids before the
first write against the company's payment modes in the dkERP table SORUPM (one keyed read per distinct id):
GiftCertificatePaymentId must be an active type 9, a cash ChangePaymentId an active type 6, and a credit-note
ChangePaymentId an active type 8. The payment-type endpoint is not used, because it is served from an index that can lag
(a mode activated recently can still show inactive), and the payment types of a Settings snapshot are not trusted either:
the table is read every time.
client.Sales.GiftCertificate.GetSettingsAsync() returns the company's gift-certificate settings (seven dkERP
company number settings) and its payment types of type 9, 8 and 6. The payment types are shown for reference, to help you
find your payment ids; the invoice flow checks the ids against the payment-mode table instead. A setting with no row in
dkERP reads as 0, as dkERP itself reads it; a flag is on only when the value is exactly 1.
GiftCertificateSettings member |
dkERP setting | Icelandic label (as shown by the client) | Meaning |
|---|---|---|---|
Storage |
SO-RETAILSYSTEMPAPERSETUPTYPE |
Geymsla | 0 = Dk (papers in dkERP), 1 = DkPos (refused) |
GiveChangeAsCreditNote |
SO-RETAILSYSTEMGIVECHANGEINCLAIMNOTES |
Gefa sjálfkrafa til baka með innleggsnótu þegar greitt er með innleggsnótu eða gjafabréfi | 1 = the desktop gives change as a credit note |
MinimumCreditNoteChange |
SO-RETAILSYSTEMMINCLAIMNOTECHANGEAMOUNT |
Viðmiðunarupphæð | The smallest change the desktop gives as a credit note |
CertificatesExpire |
SO-RETAILSYSTEMGIFTCERTIFICATESEXPIRE |
Gjafabréf renna út | 1 = new certificates expire |
ValidForDays |
SO-RETAILSYSTEMGIFTCERTVALIDFORDAYS |
Í gildi í (dagar) | Days a new certificate is valid |
AssignNumbers |
SO-RETAILSYSTEMASSIGNGIFTCERNUMBER |
Úthluta númeri á gjafabréfi sjálfkrafa | 1 = dkERP assigns the certificate number |
AssignBarcodes |
SO-RETAILSYSTEMASSIGNGIFTCARDBARCODE |
Tengja strikamerki við gjafabréf | 1 = dkERP assigns the gift-card barcode |
AssignNumbers, AssignBarcodes, CertificatesExpire and ValidForDays.GiveChangeAsCreditNote and MinimumCreditNoteChange describe the desktop'sChange (see Redeeming).GetSettingsAsync() snapshot as GiftCertificateInvoiceOptions.Settings to skip the storage and settings readsThese apply to redeeming and to selling.
Post = false is refused. An unposted invoice has number 0 in dkPlus, so it cannot be foundCurrencyCode or ExchangeRate), is not a prescriptionOptions.IsPrescription), and carries no gift-certificate or credit-note payment of its own.Sell, redeem with Redeem.UnitPrice withPricesIncludeTax = true, a quantity other than 0, and no discount, and quantity times unit price must be a whole numberOriginalPrices is refused. The client computes the total from these prices, because DK Plus's priceThe invoice is created with a uniqueness flag, so DK Plus answers 409 instead of creating a second invoice whose
reference its index already has. (That check reads an index that can lag, so it is not a guarantee.) The reference must be:
-, _ or . only between them (no leading or trailing( ) [ ] { } " ~ ^ ! | : \ / + * ?), and not the whole word AND,OR or NOT in any case.Anything else is a DkPlusModelValidationException for Invoice.Reference before any request. SALE-1007 is a valid
reference; SALE 1007 and SALE-10070000001 are not.
A certificate is spent once. Each certificate to redeem is read by number first and must be redeemable. After the
invoice is created it is marked used: valid off, used date today, status 3 (used), and the record id of the invoice it
was used on.
The check and the write are separate requests, and DK Plus has no compare-and-set, so two callers that both read the
certificate before either marks it can both succeed. See Failures and recovery.
| Payment type | Meaning | Where you give its id |
|---|---|---|
| 9 | Gift certificate | GiftCertificatePaymentId / --gift-certificate-payment-id / -GiftCertificatePaymentId |
| 6 | Exchange, "Til baka": change given back in cash | ChangePaymentId with Change = Cash |
| 8 | Credit note: change given back as a new credit note | ChangePaymentId with Change = CreditNote |