For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Managing tax identifiers

Learn how to manage tax identifiers.

Specifying a customer's type and adding any tax identifiers associated with the customer allows you to attach this data to a cart and helps ensure that Digital River's tax computations are accurate.

Customer type

Use the customerType parameter to differentiate between business and individual customers. Specifying a customer's type and adding any tax identifiers associated with a customer allows you to pass this data to a cart and helps ensure that Digital River's tax computations are accurate. See Attaching a tax identifier to a cart to learn how to set the customer's type.

Attaching a tax identifier to a cart

To attach a tax identifier, create a cart.

Optional. Send a GET /v1/shopper/me/carts/active/tax-registrations/schema request to get the tax-registrations JSON schema. You can use this schema when attaching the tax identifier to the cart.

curl --location --request GET 'https://api.digitalriver.com/v1/shoppers/me/carts/active/tax-registrations/schema' \
--header 'authorization: Basic  ***\
...
{
    "$schema": http://json-schema.org/draft-04/schema#,
    "id": https://api.digitalriver.com:443/cart-api/active/tax-registrations/schema,
    "oneOf": [
        {
            "type": "object",
            "title": "Individual",
            "additionalProperties": false,
            "required": [
                "customerType"
            ],
            "properties": {
                "customerType": {
                    "type": "string",
                    "readOnly": true,
                    "enum": [
                        "I"
                    ]
                },
                "taxRegistrations": {
                    "type": "array",
                    "title": "Tax Registrations",
                    "minItems": 1,
                    "maxItems": 1,
                    "items": [
                        {
                            "$ref": "#/definitions/CPF"
                        }
                    ]
                },
                "companyId": {
                    "type": "string"
                },
                "siteId": {
                    "type": "string"
                }
            }
        },
        {
            "type": "object",
            "title": "Business",
            "additionalProperties": false,
            "required": [
                "customerType"
            ],
            "properties": {
                "customerType": {
                    "type": "string",
                    "readOnly": true,
                    "enum": [
                        "B"
                    ]
                },
                "taxRegistrations": {
                    "type": "array",
                    "title": "Tax Registrations",
                    "minItems": 2,
                    "maxItems": 2,
                    "items": [
                        {
                            "$ref": "#/definitions/CNPJ"
                        },
                        {
                            "$ref": "#/definitions/IE"
                        }
                    ]
                },
                "companyId": {
                    "type": "string"
                },
                "siteId": {
                    "type": "string"
                }
            }
        }
    ],
    "definitions": {
        "CPF": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "value"
            ],
            "properties": {
                "key": {
                    "type": "string",
                    "readOnly": true,
                    "enum": [
                        "CPF"
                    ]
                },
                "value": {
                    "type": "string",
                    "title": "CPF",
                    "description": "Digite seu número CPF individual. O número deve ter 11 dígitos e ser inserido sem espaços, períodos ou hifens como 12345678901.",
                    "pattern": "^[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}$"
                }
            }
        },
        "IE": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "value"
            ],
            "properties": {
                "key": {
                    "type": "string",
                    "readOnly": true,
                    "enum": [
                        "IE"
                    ]
                },
                "value": {
                    "type": "string",
                    "title": "Inscrição Estadual (IE)",
                    "description": "Por favor, insira a Inscrição Estadual da sua empresa. O número deve ter 8-13 dígitos e ser inserido sem espaços, períodos ou hifens como 12345678, 1234567890123 ou ISENTO. Para encontrar a sua Inscrição Estadual, visite o site SINTEGRA.",
                    "pattern": "^[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}$,^[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}$,^[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}$,^[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}$,^[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}$,^[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}$,^[Ii]{1}[Ss]{1}[Ee]{1}[Nn]{1}[Tt]{1}[Oo]{1}$"
                }
            }
        },
        "CNPJ": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "value"
            ],
            "properties": {
                "key": {
                    "type": "string",
                    "readOnly": true,
                    "enum": [
                        "CNPJ"
                    ]
                },
                "value": {
                    "type": "string",
                    "title": "CNPJ",
                    "description": "Digite o número CNPJ da sua empresa. O número deve ter 14 dígitos e ser inserido sem espaços, períodos ou hifens como 12345678901234.",
                    "pattern": "^[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}[0-9]{1}$"
                }
            }
        }
    },
    "liveMode": false
}

Send a POST /v1/shopper/me/carts/active/tax-registrations request to attach the tax identifier to the cart. The following examples show the request body or response for customerType with the value of B for the business shopper and I for the individual shopper. You determine the value for the customerType enumerations in the schema when you attach it to the cart.

curl --location --request POST 'https://api.digitalriver.com/v1/shoppers/me/carts/active/tax-registrations' \
--header 'authorization: Basic ***\
...
{
    "customerType": "B",
    "taxRegistrations": [
        {
            "key": "CNPJ",
            "value": "77844699000109"
        },
        {
            "key": "IE",
            "value": "ISENTO"
        }
    ]
}
{
    "customerType": "I",
    "taxRegistrations": [
        {
            "key": "CPF",
            "value": "03927107492"
        }
    ]
}

If Global Tax ID Management is not enabled in Global Commerce, we return a 409 Conflict.

{
    "errors": [
        {
            "code": "vat-exemption-failure",
            "subcode": "vat-exemption-unavailable",
            "description": "Tax Exemption Rest of the World is not enabled on this site."
        }
    ]
}

Optional. Send a GET /v1/shopper/me/carts/active request to confirm the tax information is present. The following examples show the response for customerType with the value of B for a business shopper and I for an individual shopper.

Apply the source to the cart using one of the following options:

The following example shows the response body for the cart.

Removing a tax identifier from a cart

You can remove the tax identifier with or without specifying the cart identifier (cartId).

Removing a tax identifier with the cart identifier

To remove a tax identifier associated with a specific cart, use DELETE /v1/shoppers/me/carts/active/tax-registrations and include the cart identifier (cartId).

A successful response returns a 204 Not Content.

Removing a tax identifier without the cart identifier

To remove a tax identifier without a cart identifier, use DELETE /v1/shoppers/me/carts/active/tax-registrations.

A successful response returns a 204 Not Content.

If Global Tax ID Management is not enabled in Global Commerce, we return a 409 Conflict.

Last updated