# Receipts

A Receiving document

## Gets Receipts

 - [GET /receipts](https://developer.yellowdogsoftware.com/rest/fetch/api/receipts/get-receipts.md)

## Create Receipts

 - [POST /receipts](https://developer.yellowdogsoftware.com/rest/fetch/api/receipts/post-receipts.md): Using this endpoint will create uncommitted receipts. 
Marking a receipt as committed and thus making the associated adjustments to the item inventory will need to be performed using the Yellow Dog Inventory Client.

### Requirements
The following properties must exist in the database in order to be uploaded to a receipt:
* Store
* Vendor
* Items

The following requirements are needed for a receipt to be created using this method:
* The user making the request has the appropriate Edit permission to the Receipt Editor, in the store that the receipt is being created in.
* Only purchase orders that have been committed can be backlinked to a receipt

### BackLinking
One common example of backlinking is when a process exists for a location to have a purchase order created for all receipts and purchases of inventory items. This is accomplished by creating a related document for a receipt.

In Yellow Dog Inventory, we track the linkage of purchasing documents by the individual lines of a document. To accomplish this, all lines of an existing purchasing document should be marked as the backlink of another document in the process.

In example:
Given an existing Committed Purchase Order of the following shape.
json
{
	"CommdocId": 	"123e4567-e89b-12d3-a456-426655440025"
	"type": "PurchaseOrder",
	"lines": [
		{
			"CommDocLineId": "456e0001-e89b-12d3-a456-426655440000",
			"quantity": 15,
			"ItemID":"789e0001-e89b-12d3-a456-426655440000"
		}
	]
}


Can be fully recieved by sending the following general shape. Notice that the backlinkLineId of the receipt line.
json
{
	"type": "Receipt",
	...,
	"lines": [
		{
			"quantity": 15,
			"ItemID": "789e0001-e89b-12d3-a456-426655440000"
			"backLinkLineID": "456e0001-e89b-12d3-a456-426655440000"
		}
	]
}

## Get Receipt by Id

 - [GET /receipts/{id}](https://developer.yellowdogsoftware.com/rest/fetch/api/receipts/get-receipts-byid.md)

