cURL
curl --request POST 'https://api.integrateledger.com/v1/rewards/launch20/promotion-codes/ACME20/deactivate' \
-H "Authorization: Bearer $LEDGER_API_KEY"import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.deactivatePromotionCode({ rewardId: "launch20", code: "ACME20" });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.deactivate_promotion_code("launch20", "ACME20"){
"item": {
"id": "<string>",
"name": "<string>",
"kind": "coupon",
"coupon": {
"percentOff": 123,
"amountOffCents": 123,
"currency": "<string>",
"duration": "once",
"durationMonths": 123,
"planIds": [
"<string>"
]
},
"grant": {
"items": [
{
"featureId": "<string>",
"amount": 123,
"expiresAfter": {
"days": 123,
"months": 123
}
}
]
},
"maxRedemptions": 123,
"timesRedeemed": 123,
"redeemBy": "<string>",
"oncePerCustomer": true,
"archived": true,
"stripeSyncStatus": "pending",
"stripeSyncError": "<string>",
"promotionCodes": [
{
"code": "<string>",
"source": "catalog",
"active": true,
"customerId": "<string>",
"maxRedemptions": 123,
"timesRedeemed": 123,
"expiresAt": "<string>",
"firstTimeOnly": true
}
]
},
"changed": true
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "insufficient_permissions",
"requiredScope": "customers:read",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "rate_limited",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}Rewards
Deactivate a promotion code
Stop a code from being redeemed again.
POST
/
v1
/
rewards
/
{rewardId}
/
promotion-codes
/
{code}
/
deactivate
cURL
curl --request POST 'https://api.integrateledger.com/v1/rewards/launch20/promotion-codes/ACME20/deactivate' \
-H "Authorization: Bearer $LEDGER_API_KEY"import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.deactivatePromotionCode({ rewardId: "launch20", code: "ACME20" });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.deactivate_promotion_code("launch20", "ACME20"){
"item": {
"id": "<string>",
"name": "<string>",
"kind": "coupon",
"coupon": {
"percentOff": 123,
"amountOffCents": 123,
"currency": "<string>",
"duration": "once",
"durationMonths": 123,
"planIds": [
"<string>"
]
},
"grant": {
"items": [
{
"featureId": "<string>",
"amount": 123,
"expiresAfter": {
"days": 123,
"months": 123
}
}
]
},
"maxRedemptions": 123,
"timesRedeemed": 123,
"redeemBy": "<string>",
"oncePerCustomer": true,
"archived": true,
"stripeSyncStatus": "pending",
"stripeSyncError": "<string>",
"promotionCodes": [
{
"code": "<string>",
"source": "catalog",
"active": true,
"customerId": "<string>",
"maxRedemptions": 123,
"timesRedeemed": 123,
"expiresAt": "<string>",
"firstTimeOnly": true
}
]
},
"changed": true
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "insufficient_permissions",
"requiredScope": "customers:read",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "rate_limited",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}Deactivates one active code, in Ledger and in Stripe. Its redemptions and the discounts they made stay. The code’s text can be used again once it’s inactive. Needs the Catalog permission at Write.