Adding donations to purchases
This guide describes how to add donations to the purchases as order rows, so that the chosen donation is added to the payment.
1. Add the Donation product type to your client
First, you need to create products specific for donations. This type lets you create products that are not fees and not used in Norce Commerce’s business rules for physical products, like reservation for example. These products are also not included in Norce’s billing reports.
- Under Products → Settings → Product types, add Donations as a new product type.
- (optional) Rename or Change description of the type.
2. Create a product flag or category
Next, you need to put your donation products somewhere in your catalog where they easily can be fetched. We suggest to add a product flag to make it easy to list them all later using the API. A separate category might also be good to make sure that they are not shown on other listings.
- Create new flag under Products → Flags.
- Create a new category under Categories.
- Set var rates based on each markets tax rules for donations.
3. Create donation products
Donation products are much the same as ordinary products, but with the type = Donation. Set price based on your suggested donation amount. Add some content, like texts, image, etc.
- Create product
- Manufacturer could be yourself
- Status could be “hidden”
- Add onhand row, but set it to 0
- Add a price and make sure the product is included in the market price lists you want show it in.
4. Create donation products as variants or lists
It is easy to create lists of donations or choices, by using different products for different receivers of the donations and different variants for different amounts.
- Add variants for same product with different amounts.
- Add many products all with the same flag.
5. Implement the Checkout flow
Then, it's time to implement the donation buttons in the front end.
You can use the donation products as is, with your sale prices from Norce, or you can easily implement an “add your own amount” by using manual price.
- Call
ListProduct2
with your Product flag as parameter and display the list in the checkout or basket summary page. - Call
InsertBasketItem
when the user clicks on the button for the donation.
Use Manual price in the basket to set your own amount.
Get the donations /api/1.1/ProductService.svc/rest/ListProducts2?categorySeed=xxx&flagseed=yyy
Add the donations to the cart /api/1.1/ShoppingService.svc/rest/InserBasketItem?basketid=xxx
With the body
{ "PartNo": "D1000017", "Quantity": 1, "Comment": "This is a donation with pre-set amount on the pricelist", "PriceListId": 1 }
{ "PartNo": "D1000017", "Quantity": 1, "Comment": "This is a donation with custom amount", "PriceListId": 1, "Price": 50.00, "IsPriceManual": true }
6. Payment and order
The payment and order flow works in a normal way, but make sure that the ERP system receives the donation type of products correctly on the order.
Donation order line has the donation type.
... Details removed { "LineNo": "1", "ParentLineNo": null, "Type": "Donation", "TypeGroup": "AddedFee", "PartNo": "D1000017", "ErpPartNo": "D1000017", "InternalProductId": "38342592", "Description": "Help for Ukraine", "Quantity": "1", "UnitOfMeasure": null, "UnitPrice": "213.00", "UnitPriceOriginal": "213.00", "Discount": "0.00", "UnitVat": "0.00", "PriceListNo": "1", "VatRate": "0.00", "Comment": "This is a donation", "AdditionalInfo": null } ... Details removed