Links

Accessing invoices and credit memos

Learn how to access and share order invoices and credit memos
For some transactions, Digital River automatically generates order invoice and credit memo files that you can access and share with customers. To access both file types, you can implement nearly identical solutions. For test purposes, we also provide you the ability to generate mock order invoices and credit memos.

Order invoices

For sales made by the following selling entities, Digital River automatically generates an order invoice PDF:
  • Digital River, Inc.
  • DR globalTech Inc.
  • Digital River Ireland Ltd.
  • Digital River UK
  • DR Japan
By handling the order invoice created event or retrieving the order, you can get the file identifier of the order invoice and then use it to generate a shareable link. You can also download an invoice in Dashboard.
If an order's totalAmount is 0, then Digital River doesn't generate an invoice for that order.

Handling the order invoice created event

After you submit a POST/fulfillments, you can be notified when the invoice is created by listening for order.invoice.created. This event indicates that Digital River has generated an order invoice file. The event's payload contains an object.id and object.fileId. Both of these values are identical and represent the order invoice's file identifier. You can use either to create a publicly accessible link to the order invoice.
order.invoice.created
{
"id": "c902f8aa-16fb-44ba-ba7b-f3c84061685a",
"type": "order.invoice.created",
"data": {
"object": {
"id": "6e5bf525-3907-40c5-86a9-f14ce4f33f35",
"fileId": "6e5bf525-3907-40c5-86a9-f14ce4f33f35",
"orderId": "188418250336",
"customerId": "532736320336",
"purpose": "customer_invoice",
"invoiceURL": "https://api.digitalriver.com/files/6e5bf525-3907-40c5-86a9-f14ce4f33f35/content"
}
},
"liveMode": false,
"createdTime": "2021-04-28T02:04:13.591115Z",
"versionIds": []
}
The file referenced by invoiceURL can only be accessed with your confidential (secret) API key. Customers won't be able to access the file's content, so you shouldn't share this link with them.

Retrieving the invoice file identifier from the order

When you receive the order invoice created event, you can alternatively call the Orders API to retrieve the invoice's file identifier.
Once an order's invoices are generated, Digital River populates the invoicePDFs array. Each element of this array represents a file and consists of a unique id and url. If no order invoices have yet been generated, then the array doesn't exist.
Retrieve invoicePDFs[].id to create a publicly accessible link.
Order
{
"id": "188418250336",
...
"invoicePDFs": [
{
"id": "6e5bf525-3907-40c5-86a9-f14ce4f33f35",
"url": "https://api.digitalriver.com/files/6e5bf525-3907-40c5-86a9-f14ce4f33f35/content",
"liveMode": false
}
],
...
}
The file referenced by invoicePDFs[].url can only be accessed with your confidential (secret) API key. Customers won't be able to access the file's content, so you shouldn't share this link with them.
Once you receive the order invoice created event, you can retrieve the invoice's file identifier from its payload and use that value to set fileId in a create file link request.
order.invoice.created
POST/file-links
data.object.id or data.object.fileId
fileId
Alternatively, after receiving the order invoice created event, you can retrieve the invoice's file identifier from the order and pass it in a POST/file-links.
Order
POST/file-links
invoicePDFs[].id
fileId
The response contains a a publicly accessible url that can be used to download the file. You can share that url with your customers by email, through their account management portals, or another method of your choice.

Credit memos

By handling the credit memo created event or retrieving the order, you can get the file identifier of the credit memo and then use it to generate a shareable link.

Handling the credit memo created event

You can be notified when the credit memo is created by listening for order.credit_memo.created. This event indicates that Digital River generated a credit memo file. The event's payload contains an object.id and object.fileId. Both of these values are identical and represent the identifier of the credit memo file. You can use either to create a publicly accessible link to the credit memo.
order.credit_memo.created
{
"id": "d3786b5b-540b-4885-92a4-62f937d13f26",
"type": "order.credit_memo.created",
"data": {
"object": {
"id": "c233c10f-17e8-4799-a1ce-2469d042f29d",
"fileId": "c233c10f-17e8-4799-a1ce-2469d042f29d",
"orderId": "188466550336",
"customerId": "532795950336",
"purpose": "customer_credit_memo",
"invoiceURL": "https://api.digitalriver.com/files/c233c10f-17e8-4799-a1ce-2469d042f29d/content"
}
},
"liveMode": false,
"createdTime": "2021-04-29T02:15:20.516626Z",
"versionIds": []
}
The file referenced by invoiceURL can only be accessed with your confidential (secret) API key. Customers won't be able to access the file's content, so you shouldn't share this link with them.

Retrieving the credit memo file identifier from the order

When you receive the credit memo created event, you can also call the Orders API to retrieve the file identifier of the credit memo.
Once an order's credit memos are generated, we populate the creditMemoPDFs array. Each element of this array represents a file and consists of a unique id and url. If no credit memos have yet been generated, then the array doesn't exist.
Once you retrieve creditMemoPDFs[].id , you can use this value to create a publicly accessible link.
Order
{
"id": "188418250336",
...
"creditMemoPDFs": [
{
"id": "fb50c8c2-8b32-4a3d-9947-dbdef12a5cdc",
"url": "https://api.digitalriver.com/files/fb50c8c2-8b32-4a3d-9947-dbdef12a5cdc/content",
"liveMode": false
}
],
...
}
The file referenced by creditMemoPDFs[].url can only be accessed with your confidential (secret) API key. Customers won't be able to access its content, so you shouldn't share this link with them.
Once you receive the credit memo created event, you can retrieve the file identifier of the credit memo from its payload and use that value to set fileId in a create file link request.
order.credit_memo.created
POST/file-links
data.object.id or data.object.fileId
fileId
Alternatively, after receiving the credit memo created event, you can retrieve the credit memo file identifier from the order and pass it in a POST/file-links.
Order
POST/file-links
creditMemoPDFs[].id
fileId
The response contains a publicly accessible url that can be used to download the file. You can share that url with your customers by email, through their account management portal, or another method of your choice.

Mock order invoices and credit memos

While working in test mode, you can also receive order invoice and credit memo files. The process of accessing these sample files in test mode is identical to the production mode process.
The following are example mock tax invoice and credit memo PDFs:
vat-invoice.pdf
59KB
PDF
Sample VAT invoice
credit-memo.pdf
67KB
PDF
Sample credit memo