customerVariantPrice
Requires at least one of the permissions payments:invoice:create, products:pricing:read, purchase:debit_note:create, purchase:purchase_order:create, purchase:purchase_order:update, sales:credit_note:create, sales:quote:create, sales:quote:update, sales:sales_invoice:create, sales:sales_order:create or sales:sales_order:update.
Returns the price of a variant for a unit and quantity, including tiers, packs, tax and automatic discounts, through the same pricing every surface uses. In a foreign currency it returns only a price set in that currency and reports that none exists rather than converting, unless a conversion rate is supplied. Needs the pricing read permission, or permission to create or edit a document that prices lines. A customer outside your book is reported as not found.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query CustomerVariantPrice($variantId: String!) {
customerVariantPrice(variantId: $variantId) {
currencyCode
customerTierName
automaticDiscountAmount
automaticDiscountPercent
convertedAtRate
convertedFromBaseUnitPrice
appliedDiscounts {
id
code
name
type
discountAmount
fixedAmount
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query CustomerVariantPrice($variantId: String!) {\n customerVariantPrice(variantId: $variantId) {\n currencyCode\n customerTierName\n automaticDiscountAmount\n automaticDiscountPercent\n convertedAtRate\n convertedFromBaseUnitPrice\n appliedDiscounts {\n id\n code\n name\n type\n discountAmount\n fixedAmount\n }\n }\n}",
"variables": {
"variantId": "string"
}
}
EOF
Variables:
{
"variantId": "string"
}
Response:
{
"data": {
"customerVariantPrice": {
"currencyCode": "string",
"customerTierName": "string",
"automaticDiscountAmount": 0,
"automaticDiscountPercent": 0,
"convertedAtRate": 0,
"convertedFromBaseUnitPrice": 0,
"appliedDiscounts": [
{
"id": "string",
"code": "string",
"name": "string",
"type": "string",
"discountAmount": 0,
"fixedAmount": 0
}
]
}
}
}
customerVariantPrice(
convertAtRate: Float
currency: String
partnerId: String
quantity: Float
taxDate: String
uomId: String
variantId: String!
): CustomerVariantPrice!
Arguments
customerVariantPrice.convertAtRate ● Float scalar
Opt-in conversion rate, where 1 unit of the currency equals this many base units. A foreign currency with no price of its own is then priced by converting the base price. A price set in that currency always wins.
customerVariantPrice.currency ● String scalar
ISO 4217 currency code to price in. Omit it to price in the base currency.
customerVariantPrice.partnerId ● String scalar
The ID of the customer the price is for. Optional: it only decides which discount schemes and tax exemptions apply.
customerVariantPrice.quantity ● Float scalar
The quantity to price. Defaults to 1 when omitted or not above zero.
customerVariantPrice.taxDate ● String scalar
The calendar day, as YYYY-MM-DD, on which the customer's tax exemption is judged. Defaults to today. Anything that is not a calendar day is refused.
customerVariantPrice.uomId ● String scalar
The ID of the unit of measure to price the variant in.
customerVariantPrice.variantId ● String! non-null scalar
The ID of the variant.
Type
CustomerVariantPrice object
The resolved single price for a variant (per selected UOM + qty), plus automatic-discount breakdown and the P1d line-pricing exposure.