docs: update pricing module docs with the latest changes (#5749)

Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
This commit is contained in:
Riqwan Thamir
2023-11-28 10:56:57 +01:00
committed by GitHub
parent deca78f749
commit 870d686136

View File

@@ -21,12 +21,18 @@ export async function POST(request: Request) {
const pricingService = await initializePricingModule()
const body = await request.json()
// A rule type with `rule_attribute=region_id` should
// already be present in the database
const priceSet = await pricingService.create([
{
rules: [{ rule_attribute: "region_id" }],
prices: [
{
currency_code: body.currency_code,
amount: body.amount,
rules: {
region_id: body.region_id,
},
},
],
},
@@ -248,4 +254,4 @@ export async function GET(
## More Examples
The [module interface reference](../../references/pricing/interfaces/IPricingModuleService.mdx) provides a reference to all the methods available for use with examples for each.
The [module interface reference](../../references/pricing/interfaces/IPricingModuleService.mdx) provides a reference to all the methods available for use with examples for each.