www/apps/resources/references/promotion/IPromotionModuleService/methods/promotion.IPromotionModuleService.registerUsage/page.mdx
import { TypeList } from "docs-ui"
This documentation provides a reference to the registerUsage method. This belongs to the Promotion Module.
You should only use this methods when implementing complex customizations. For common cases, check out available workflows instead.
</Note>This method adjusts the budget for each campaign associated with the promotions' specified computed actions.
It adjusts the used property of a CampaignBudget to account for the adjustment amounts in the specified associated
computed actions.
await promotionModuleService.registerUsage([
{
amount: 50,
code: "50OFF",
},
{
amount: 5000,
code: "FREESHIPPING",
},
])
<TypeList types={[{"name":"computedActions","type":"UsageComputedActions[]","description":"The computed actions to adjust their promotion's campaign budget.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"amount","type":"BigNumberInput","description":"The amount (of usage or money) to adjust the campaign budget by.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"value","type":"string \| number","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"numeric","type":"number","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"raw","type":"BigNumberRawValue","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"bigNumber","type":"BigNumber","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"code","type":"string","description":"The promotion's code.","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"registrationContext","type":"CampaignBudgetUsageContext","description":"The context of the campaign budget usage.","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"customer_id","type":"string \| null","description":"The ID of the customer.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"customer_email","type":"string \| null","description":"The email of the customer.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="registerUsage"/>
<TypeList types={[{"name":"Promise","type":"Promise<void>","optional":false,"defaultValue":"","description":"Resolves when the campaign budgets have been adjusted successfully.","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="registerUsage"/>