Give a discount on a sale — coupon, points or staff
Apply a coupon code, redeem a customer’s loyalty points or attach an employee discount to an open order — the order keeps the maths and the who.
Selling · a play in 3 steps.
The steps
- Apply a coupon code — re-validated when the order places. — applyOrderCoupon
- Redeem the customer’s points against the order. — applyOrderLoyalty
- Attach an employee discount — one employee per order, named in the record. — applyOrderEmployeeDiscount
The calls
Every operation this use case runs, in the order it first appears, with the request and the response its reference page shows.
applyOrderCoupon
applyOrderCoupon — mutation · Apply a coupon code to an open order.
Example request
mutation ExampleApplyOrderCoupon($orderId: ID!, $revision: ID!, $code: String!) {
applyOrderCoupon(orderId: $orderId, revision: $revision, code: $code) {
id
sysId
type
caption
status
parentId
rootId
createdAt
updatedAt
revisionNum
revision
organizationId
channel
orderType
validUntil
termEndsAt
convertedOrderId
sourceDocumentId
reorderOfOrderId
logicalFacilityId
currency
exemptionCertificateId
paymentState
fulfillmentState
recognitionState
taxJurisdictionId
subtotalMinor
discountTotalMinor
taxTotalMinor
totalMinor
fulfillmentFeeMinor
fulfillmentFeeTaxMinor
tenderedNetMinor
tipTotalMinor
paymentIds
refundIds
disputeIds
invoiceIds
couponIds
sourcingSagaId
commissionAgentUserIds
affiliateId
}
}
Variables:
{
"orderId": "01900000-0000-7000-8000-f6d8263a0000",
"revision": "01900000-0000-7000-8000-b7960e180000",
"code": "BJ-001"
}
Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.
Example response
{
"data": {
"applyOrderCoupon": {
"id": "01900000-0000-7000-8000-37386ae00000",
"sysId": "SO-EXMP-0000-000F",
"type": "Order",
"caption": "Blue jeans",
"status": "open",
"parentId": "01900000-0000-7000-8000-065235280000",
"rootId": "01900000-0000-7000-8000-a093dd800000",
"createdAt": "2027-01-31T00:00:00.000Z",
"updatedAt": "2027-01-31T00:00:00.000Z",
"revisionNum": 1,
"revision": "01900000-0000-7000-8000-b7960e180000",
"organizationId": "01900000-0000-7000-8000-44b781470000",
"channel": "pos",
"orderType": "sale",
"validUntil": "<valid until>",
"termEndsAt": "2027-01-31T00:00:00.000Z",
"convertedOrderId": "01900000-0000-7000-8000-b1563ac60000",
"sourceDocumentId": "01900000-0000-7000-8000-8fd6a7c40000",
"reorderOfOrderId": "01900000-0000-7000-8000-5533d5a60000",
"logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000",
"currency": "USD",
"exemptionCertificateId": "01900000-0000-7000-8000-6c082e160000",
"paymentState": "<payment state>",
"fulfillmentState": "<fulfillment state>",
"recognitionState": "<recognition state>",
"taxJurisdictionId": "01900000-0000-7000-8000-3a64e3820000",
"subtotalMinor": 1,
"discountTotalMinor": 1,
"taxTotalMinor": 1,
"totalMinor": 1,
"fulfillmentFeeMinor": 1,
"fulfillmentFeeTaxMinor": 1,
"tenderedNetMinor": 1,
"tipTotalMinor": 1,
"paymentIds": [
"01900000-0000-7000-8000-f1636a750000"
],
"refundIds": [
"01900000-0000-7000-8000-a5d2e2d30000"
],
"disputeIds": [
"01900000-0000-7000-8000-d72df27f0000"
],
"invoiceIds": [
"01900000-0000-7000-8000-0a4b14ba0000"
],
"couponIds": [
"01900000-0000-7000-8000-6a9b05ef0000"
],
"sourcingSagaId": "01900000-0000-7000-8000-2dfe37aa0000",
"commissionAgentUserIds": [
"01900000-0000-7000-8000-7aaf99300000"
],
"affiliateId": "01900000-0000-7000-8000-ab1bc9b90000"
}
},
"extensions": {
"at": {
"callId": "01EXAMPLE-CALL-ID",
"version": {
"requested": {
"name": "genesis",
"number": 0
},
"serviced": {
"name": "genesis",
"number": 0
}
}
}
}
}
applyOrderLoyalty
applyOrderLoyalty — mutation · Redeem a customer’s loyalty points against an open order.
Example request
mutation ExampleApplyOrderLoyalty($orderId: ID!, $revision: ID!, $memberId: ID!, $redeemPoints: Int) {
applyOrderLoyalty(orderId: $orderId, revision: $revision, memberId: $memberId, redeemPoints: $redeemPoints) {
id
sysId
type
caption
status
parentId
rootId
createdAt
updatedAt
revisionNum
revision
organizationId
channel
orderType
validUntil
termEndsAt
convertedOrderId
sourceDocumentId
reorderOfOrderId
logicalFacilityId
currency
exemptionCertificateId
paymentState
fulfillmentState
recognitionState
taxJurisdictionId
subtotalMinor
discountTotalMinor
taxTotalMinor
totalMinor
fulfillmentFeeMinor
fulfillmentFeeTaxMinor
tenderedNetMinor
tipTotalMinor
paymentIds
refundIds
disputeIds
invoiceIds
couponIds
sourcingSagaId
commissionAgentUserIds
affiliateId
}
}
Variables:
{
"orderId": "01900000-0000-7000-8000-f6d8263a0000",
"revision": "01900000-0000-7000-8000-b7960e180000",
"memberId": "01900000-0000-7000-8000-80d971ae0000",
"redeemPoints": 1
}
Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.
Example response
{
"data": {
"applyOrderLoyalty": {
"id": "01900000-0000-7000-8000-37386ae00000",
"sysId": "SO-EXMP-0000-000F",
"type": "Order",
"caption": "Blue jeans",
"status": "open",
"parentId": "01900000-0000-7000-8000-065235280000",
"rootId": "01900000-0000-7000-8000-a093dd800000",
"createdAt": "2027-01-31T00:00:00.000Z",
"updatedAt": "2027-01-31T00:00:00.000Z",
"revisionNum": 1,
"revision": "01900000-0000-7000-8000-b7960e180000",
"organizationId": "01900000-0000-7000-8000-44b781470000",
"channel": "pos",
"orderType": "sale",
"validUntil": "<valid until>",
"termEndsAt": "2027-01-31T00:00:00.000Z",
"convertedOrderId": "01900000-0000-7000-8000-b1563ac60000",
"sourceDocumentId": "01900000-0000-7000-8000-8fd6a7c40000",
"reorderOfOrderId": "01900000-0000-7000-8000-5533d5a60000",
"logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000",
"currency": "USD",
"exemptionCertificateId": "01900000-0000-7000-8000-6c082e160000",
"paymentState": "<payment state>",
"fulfillmentState": "<fulfillment state>",
"recognitionState": "<recognition state>",
"taxJurisdictionId": "01900000-0000-7000-8000-3a64e3820000",
"subtotalMinor": 1,
"discountTotalMinor": 1,
"taxTotalMinor": 1,
"totalMinor": 1,
"fulfillmentFeeMinor": 1,
"fulfillmentFeeTaxMinor": 1,
"tenderedNetMinor": 1,
"tipTotalMinor": 1,
"paymentIds": [
"01900000-0000-7000-8000-f1636a750000"
],
"refundIds": [
"01900000-0000-7000-8000-a5d2e2d30000"
],
"disputeIds": [
"01900000-0000-7000-8000-d72df27f0000"
],
"invoiceIds": [
"01900000-0000-7000-8000-0a4b14ba0000"
],
"couponIds": [
"01900000-0000-7000-8000-6a9b05ef0000"
],
"sourcingSagaId": "01900000-0000-7000-8000-2dfe37aa0000",
"commissionAgentUserIds": [
"01900000-0000-7000-8000-7aaf99300000"
],
"affiliateId": "01900000-0000-7000-8000-ab1bc9b90000"
}
},
"extensions": {
"at": {
"callId": "01EXAMPLE-CALL-ID",
"version": {
"requested": {
"name": "genesis",
"number": 0
},
"serviced": {
"name": "genesis",
"number": 0
}
}
}
}
}
applyOrderEmployeeDiscount
applyOrderEmployeeDiscount — mutation · Attach an employee discount to an open order (one employee per order).
Example request
mutation ExampleApplyOrderEmployeeDiscount($orderId: ID!, $revision: ID!, $userId: ID!, $percentPpm: Int!) {
applyOrderEmployeeDiscount(orderId: $orderId, revision: $revision, userId: $userId, percentPpm: $percentPpm) {
id
sysId
type
caption
status
parentId
rootId
createdAt
updatedAt
revisionNum
revision
organizationId
channel
orderType
validUntil
termEndsAt
convertedOrderId
sourceDocumentId
reorderOfOrderId
logicalFacilityId
currency
exemptionCertificateId
paymentState
fulfillmentState
recognitionState
taxJurisdictionId
subtotalMinor
discountTotalMinor
taxTotalMinor
totalMinor
fulfillmentFeeMinor
fulfillmentFeeTaxMinor
tenderedNetMinor
tipTotalMinor
paymentIds
refundIds
disputeIds
invoiceIds
couponIds
sourcingSagaId
commissionAgentUserIds
affiliateId
}
}
Variables:
{
"orderId": "01900000-0000-7000-8000-f6d8263a0000",
"revision": "01900000-0000-7000-8000-b7960e180000",
"userId": "01900000-0000-7000-8000-11f967df0000",
"percentPpm": 1
}
Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.
Example response
{
"data": {
"applyOrderEmployeeDiscount": {
"id": "01900000-0000-7000-8000-37386ae00000",
"sysId": "SO-EXMP-0000-000F",
"type": "Order",
"caption": "Blue jeans",
"status": "open",
"parentId": "01900000-0000-7000-8000-065235280000",
"rootId": "01900000-0000-7000-8000-a093dd800000",
"createdAt": "2027-01-31T00:00:00.000Z",
"updatedAt": "2027-01-31T00:00:00.000Z",
"revisionNum": 1,
"revision": "01900000-0000-7000-8000-b7960e180000",
"organizationId": "01900000-0000-7000-8000-44b781470000",
"channel": "pos",
"orderType": "sale",
"validUntil": "<valid until>",
"termEndsAt": "2027-01-31T00:00:00.000Z",
"convertedOrderId": "01900000-0000-7000-8000-b1563ac60000",
"sourceDocumentId": "01900000-0000-7000-8000-8fd6a7c40000",
"reorderOfOrderId": "01900000-0000-7000-8000-5533d5a60000",
"logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000",
"currency": "USD",
"exemptionCertificateId": "01900000-0000-7000-8000-6c082e160000",
"paymentState": "<payment state>",
"fulfillmentState": "<fulfillment state>",
"recognitionState": "<recognition state>",
"taxJurisdictionId": "01900000-0000-7000-8000-3a64e3820000",
"subtotalMinor": 1,
"discountTotalMinor": 1,
"taxTotalMinor": 1,
"totalMinor": 1,
"fulfillmentFeeMinor": 1,
"fulfillmentFeeTaxMinor": 1,
"tenderedNetMinor": 1,
"tipTotalMinor": 1,
"paymentIds": [
"01900000-0000-7000-8000-f1636a750000"
],
"refundIds": [
"01900000-0000-7000-8000-a5d2e2d30000"
],
"disputeIds": [
"01900000-0000-7000-8000-d72df27f0000"
],
"invoiceIds": [
"01900000-0000-7000-8000-0a4b14ba0000"
],
"couponIds": [
"01900000-0000-7000-8000-6a9b05ef0000"
],
"sourcingSagaId": "01900000-0000-7000-8000-2dfe37aa0000",
"commissionAgentUserIds": [
"01900000-0000-7000-8000-7aaf99300000"
],
"affiliateId": "01900000-0000-7000-8000-ab1bc9b90000"
}
},
"extensions": {
"at": {
"callId": "01EXAMPLE-CALL-ID",
"version": {
"requested": {
"name": "genesis",
"number": 0
},
"serviced": {
"name": "genesis",
"number": 0
}
}
}
}
}