-
-
Notifications
You must be signed in to change notification settings - Fork 313
Draft Orders
Joshua Harms edited this page Dec 20, 2023
·
1 revision
You can use the DraftOrder resource to allow merchants to create orders on behalf of customers. This is useful for Shopify merchants who receive orders through outside channels and enables a wide range of use cases including the following:
- Create new orders for sales made by phone, in person, via chat, or by other means. Credit card payments for these orders can subsequently be entered in the Shopify admin.
- Send invoices to customers to pay with a secure checkout link.
- Use custom items to represent additional costs or products that aren't displayed in a shop's inventory.
- Re-create mistaken orders.
- Sell products at discount or wholesale rates.
- Take pre-orders.
var service = new DraftOrderService(myShopifyUrl, shopAccessToken);
var draftOrders = await service.ListAsync();
var service = new DraftOrderService(myShopifyUrl, shopAccessToken);
var count = await service.CountAsync();
var service = new DraftOrderService(myShopifyUrl, shopAccessToken);
var draftOrder = await service.GetAsync(draftOrderId);
var service = new DraftOrderService(myShopifyUrl, shopAccessToken);
var draftOrder = await Service.CreateAsync(new DraftOrder()
{
LineItems = new List<DraftLineItem>()
{
new DraftLineItem()
{
Title = "My custom line item",
Price = 15.00m,
Quantity = 1,
}
},
Note = "Hello world!"
});
var service = new DraftOrderService(myShopifyUrl, shopAccessToken);
var original = await Service.GetAsync(originalOrderId);
original.Note = "My new note";
var updated = await Service.UpdateAsync(originalOrderId, original);
var service = new DraftOrderService(myShopifyUrl, shopAccessToken);
await service.DeleteAsync(orderId);
var service = new DraftOrderService(myShopifyUrl, shopAccessToken);
var invoice = await service.SendInvoiceAsync(new DraftOrderInvoice()
{
To = "[email protected]",
Subject = "Your order is ready to pay",
CustomMessage = "Please pay!"
});
var service = new DraftOrderService(myShopifyUrl, shopAccessToken);
bool paymentPending = false;
var draftOrder = await service.CompleteAsync(orderId, paymentPending);