Accessing invoices and credit memos

Learn how to access order invoices and credit memos and then share them with your customers

For some transactions, Digital River automatically generates the order invoice and credit memo files that you can access and then share with your customers. To do this, you can implement nearly identical solutions.

To localize these files, set the checkout's locale.

For testing purposes, we also provide you the ability to generate mock order invoices and credit memos.

Order invoices

In transactions assigned to one of the following selling entities, Digital River generates an order invoice in PDF that you can share with customers:

  • Digital River, Inc.

  • DR globalTech Inc.

  • Digital River Ireland Ltd.

  • Digital River UK

  • DR Japan

How to access the invoice file

By listening for the order invoice created event or by retrieving the order, you can get an invoice's file identifier and then use it to generate a shareable link.

You can also download an invoice in Digital River Dashboard.

If an order's totalAmount is 0, then Digital River doesn't generate a customer invoice.

Listening for the order invoice created event

You can be notified when the invoice is created by listening for the event with a type of order.invoice.created.

The event's data.object contains an id and a fileId, both of which are identical and contain the invoice's file identifier. You can use either to create a publicly accessible link.

{
    "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": []
}

In the event's data.object, the invoiceURL can only be accessed with your confidential (secret) API key. Since your customers won't be able to access the contents of this link, don't share it with them.

Retrieving the invoice file identifier from the order

To access the customer invoice file, you can also retrieve the order.

Once invoices are generated, Digital River populates the order's invoicePDFs[]. If invoicePDFs[] doesn't exist, then the file(s) have yet to be created.

Each element of this array contains a file's unique id and url.

You'll need to use invoicePDFs[].id to create a publicly accessible link.

In the order, the invoicePDFs[].url can only be accessed with your confidential (secret) API key. Since your customers won't be able to access the contents of this link, don't share it with them.

{
    "id": "188418250336",
    ...
    "invoicePDFs": [
        {
            "id": "6e5bf525-3907-40c5-86a9-f14ce4f33f35",
            "url": "https://api.digitalriver.com/files/6e5bf525-3907-40c5-86a9-f14ce4f33f35/content",
            "liveMode": false
        }
    ],
    ...
}

To create a publicly accessible link to the invoice file, assign its identifier to fileId and send it in the body of a POST /file-links request.

The response contains a url that you can share with your customers by email, in their account management portals, or by another method of your choice.

Credit memos

A credit memo is a document issued to customers notifying them of a reduction in the amount they owe.

How to access the credit memo file

By listening for the credit memo created event or by retrieving the order, you can get a credit memo's file identifier and then use it to generate a shareable link.

Listening for the credit memo created event

You can be notified when a credit memo is created by listening for the event with a type of order.credit_memo.created.

The event's data.object contains an id and a fileId, both of which are identical and contain the credit memo's file identifier. You can use either to create a publicly accessible link.

{
    "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": []
}

In the event's data.object, the invoiceURL can only be accessed with your confidential (secret) API key. Since your customers won't be able to access the contents of this link, don't share it with them.

Retrieving the credit memo file identifier from the order

To access a customer's credit memo file, you can also retrieve the order.

Once credit memos are generated, Digital River populates the order's creditMemoPDFs[]. If creditMemoPDFs[] doesn't exist, then the file(s) have yet to be created.

Each element of this array contains a file's unique id and url.

You'll need to use creditMemoPDFs[].id to create a publicly accessible link.

In the order, the creditMemoPDFs[].url can only be accessed with your confidential (secret) API key. Since your customers won't be able to access the contents of this link, don't share it with them.

{
    "id": "188418250336",
    ...
    "creditMemoPDFs": [
        {
            "id": "fb50c8c2-8b32-4a3d-9947-dbdef12a5cdc",
            "url": "https://api.digitalriver.com/files/fb50c8c2-8b32-4a3d-9947-dbdef12a5cdc/content",
            "liveMode": false
        }
    ],
    ...
}

To create a publicly accessible link to a customer's credit memo file, assign its identifier to fileId and send it in the body of a POST /file-links request.

The response contains a url that you can share with your customers by email, in their account management portals, or by another method of your choice.

Mock order invoices and credit memos

You can also generate the order invoice and credit memo files in test mode. Accessing them is the same as in the production environment.

The following are example mock tax invoice and credit memo PDFs:

Last updated