import { Crevio } from "@crevio/sdk";
const crevio = new Crevio({
apiKey: process.env["CREVIO_API_KEY"] ?? "",
});
async function run() {
const result = await crevio.discounts.update({
id: "<id>",
discountRequest: {},
});
console.log(result);
}
run();{
"id": "<string>",
"object": "<string>",
"status": "active",
"discount_type": "percentage",
"code": "<string>",
"amount_off": 123,
"duration": "forever",
"duration_in_months": 123,
"max_redemptions": 123,
"times_redeemed": 123,
"redeem_by": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"percent_off": 123,
"currency": "<string>"
}Updates an existing discount
import { Crevio } from "@crevio/sdk";
const crevio = new Crevio({
apiKey: process.env["CREVIO_API_KEY"] ?? "",
});
async function run() {
const result = await crevio.discounts.update({
id: "<id>",
discountRequest: {},
});
console.log(result);
}
run();{
"id": "<string>",
"object": "<string>",
"status": "active",
"discount_type": "percentage",
"code": "<string>",
"amount_off": 123,
"duration": "forever",
"duration_in_months": 123,
"max_redemptions": 123,
"times_redeemed": 123,
"redeem_by": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"percent_off": 123,
"currency": "<string>"
}API key in the format: Bearer {api_token}
The resource ID (e.g., "prod_abc123") or slug (e.g., "my-product")
percentage, fixed forever, once, repeating Discount updated
active, inactive percentage, fixed forever, once, repeating Was this page helpful?