Herald
OpenapiBilling

Batch-save all price mappings for a product.

Validation/permission order: 1. `billing.manage` (realm boundary + business permission). 2. If any update row carries a credit-strategy field → `points.manage`. 3. Credit-strategy field validation. Then the repository performs a single-transaction upsert of all the product's price rows: any row transitioning enabled true→false while protected by an active subscription rolls back the WHOLE transaction (409 with `{ activeSubscriptions }`). Cross-realm/product `mapping_id` tampering surfaces as 400.

PUT
/api/bill/entitlement-mappings/batch

Validation/permission order:

  1. billing.manage (realm boundary + business permission).
  2. If any update row carries a credit-strategy field → points.manage.
  3. Credit-strategy field validation.

Then the repository performs a single-transaction upsert of all the product's price rows: any row transitioning enabled true→false while protected by an active subscription rolls back the WHOLE transaction (409 with { activeSubscriptions }). Cross-realm/product mapping_id tampering surfaces as 400.

Authorization

bearer_auth
headerAuthorizationBearer <token>

Request Body

application/json
  1. body

PUT /api/bill/entitlement-mappings/batch request body.

externalProductId*string
paymentProvider*string
updates*array<>

Response Body

Batch saved successfully

application/json
  1. response

PUT /api/bill/entitlement-mappings/batch response body.

prices returns the product's full latest set of price rows. Reuses EntitlementMappingResponse as the per-price view.

prices*array<>
saved*integer
Formatint32
Range0 <= value
Example Request
curl -X PUT 'https://example.com/api/bill/entitlement-mappings/batch' \
  -H 'Content-Type: application/json' \
  -d '{
  "externalProductId": "string",
  "paymentProvider": "string",
  "updates": [
    {
      "mappingId": "455df1f6-33e0-45b1-a8aa-27c64555cdd0"
    }
  ]
}'
Example Response
{
  "prices": [
    {
      "billingPeriod": "string",
      "billingType": "string",
      "createdAt": "string",
      "enabled": true,
      "entitlementKey": "string",
      "externalPriceId": "string",
      "externalProductId": "string",
      "grantedRoleIds": [
        "d7da45c3-cf14-4d32-83d9-df3496b53a96"
      ],
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "paymentProvider": "string",
      "pointRules": [
        {
          "bucketId": "1980377d-7926-47e0-9e64-a9d0c746404d",
          "displayOrder": 0,
          "enabled": true,
          "grantMode": "string",
          "grantPeriodType": "string",
          "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
          "pointsAmount": 0,
          "quotaWindows": [
            {
              "key": "string",
              "limit": 0,
              "windowSeconds": 0
            }
          ],
          "triggerSources": [
            "string"
          ],
          "validityDays": 0
        }
      ],
      "providerProductInfo": null,
      "serviceDurationDays": 0,
      "syncedAt": "string",
      "updatedAt": "string"
    }
  ],
  "saved": 0
}