Producer codes

A producer code is a value that associates a producer with a commission plan. A producer has one producer code for every commission plan that producer uses. From a functional perspective, producers must have at least one producer code, though you can create producers without producer codes through Cloud API.

Producer codes are also used to associate policies with producers. When a policy that earns commission is bound, it must have a producer code for every relevant producer role.

For more information on producer codes in BillingCenter, see Producer codes.

Querying for producer codes

Use the following endpoints to retrieve producer codes:

  • GET /billing/v1/producers/{producerId}/producer-codes
  • GET /billing/v1/producers/{producerId}/producer-codes/{producerCodeId}

The following example call retrieves a single producer code:

Command
GET /billing/v1/producers/bc:178/producer-codes/bc:195
Response
{
    "data": {
        "attributes": {
            "active": true,
            "code": "Cloud API Code",
            "commissionPlan": {
                "displayName": "Commission Plan ILLUBO96",
                "id": "bc:ScvbrLrQ_FT0Dl4OZrvgR",
                "type": "CommissionPlan",
                "uri": "/admin/v1/commission-plans/bc:ScvbrLrQ_FT0Dl4OZrvgR"
            },
            "id": "bc:195"
        },
	...
    }
}

Creating producer codes

Create producer codes using the following endpoint:

  • POST /billing/v1/producers/{producerId}/producer-codes
Only two fields are required when creating producer codes:
  • code - The name of the producer code, as a string
  • commissionPlan - A reference to an existing commission plan
Note: In Cloud API, the field code is usually used for references to typelists. In this case, the field code is not a typekey reference, but a string which contains the name of the producer code.

The following demonstrates a minimal call to create a producer code:

Command

POST /billing/v1/producers/bc:178/producer-codes

Request body

{
    "data": {
        "attributes": {
            "code": "Cloud API Code 2",
            "commissionPlan": {
                "id": "bc:S3EvNMry_1x0s0XwyTjVx"
            }
        }
    }
}

Modifying producer codes

Use the following endpoint to modify producer codes:

  • PATCH /billing/v1/producers/{producerId}/producer-codes/{producerCodeId}

The following call modifies a producer code, setting the active field on the producer code to false. This field is used to indicate whether the producer code is available for new policies.

Command

PATCH /billing/v1/producers/bc:178/producer-codes/bc:195

Request body

{
    "data": {
        "attributes": {
            "active": false
        }
    }
}