update field hs_term_in_months for line item through API

Our integration creates quote with custom line items through API.

I am trying to set value to field hs_term_in_months for line item but the value does not seem to register. it shows 0 in the UI when the operation is complete.

I understand that this field is dependant on billing frequemcy, so I set

billing frequemcy to “annualy” and hs_term_in_months = 12, but still not successful.

I am able to set the value through UI.

Hey, @DealHubIntegr :waving_hand: Thanks for the interesting question. It looks to be related to this post and solution — Unable to set billing period on line items via the API

If you have a moment can you try testing the Line Item creation endpoint example and running a quick test, please?

  • Use this endpoint and the example provided here — Line Items
    POST /crm/v3/objects/line_items​

  • Make sure you are using the following values in your request

    "hs_recurring_billing_period":
     "recurringbillingfrequency":​
    

In my test, I received a warning until I changed the formatting for

“hs_recurring_billing_period” from “24” to “P24M”

Here’s my request and response:

  • Request body

    {
     "properties": {
     "name": "1 year implementation consultation",
     "hs_product_id": "1567706789",
     "hs_recurring_billing_period": "P24M",
     "recurringbillingfrequency": "monthly",
     "quantity": "2",
     "price": "6000.00"
     }
    }
    
  • Response body:

    201 Created
    
    {
     "id": "3488598947",
     "properties": {
     "amount": "12000.000",
     "createdate": "2022-08-02T21:26:13.582Z",
     "description": "Amazing cats for hire!",
     "hs_acv": "144000.000",
     "hs_arr": "144000.000",
     "hs_lastmodifieddate": "2022-08-02T21:26:13.582Z",
     "hs_margin": "12000.000",
     "hs_margin_acv": "144000.000",
     "hs_margin_arr": "144000.000",
     "hs_margin_mrr": "12000.000",
     "hs_margin_tcv": "288000.000",
     "hs_mrr": "12000.000",
     "hs_object_id": "3488598947",
     "hs_pre_discount_amount": "12000.000",
     "hs_product_id": "1567706789",
     "hs_recurring_billing_number_of_payments": "24",
     "hs_recurring_billing_period": "P24M",
     "hs_recurring_billing_terms": "FIXED",
     "hs_tcv": "288000.000",
     "hs_term_in_months": "24",
     "hs_total_discount": "0.000",
     "name": "1 year implementation consultation",
     "price": "6000.00",
     "quantity": "2",
     "recurringbillingfrequency": "monthly"
     },
     "createdAt": "2022-08-02T21:26:13.582Z",
     "updatedAt": "2022-08-02T21:26:13.582Z",
     "archived": false
    }​
    

    I’ll work on getting a request submitted to get the documentation update. If it still gives you trouble after adding,"P(YOUR_INTERGER)M"​please add your test request and response and the community can take a look.

Best,

Jaycee

hey Jaycee, thanks for the prompt reply. the solution works fine and was able to set the desired billing frequency.

That’s wonderful! Thanks for letting us know :blush: — Jaycee

Could you help with what are the correct values to use?

I tried variations of the P (Interger) M it does not set the values I need.

I need lines items to be due at payment and renew until canceled.

‘hs_recurring_billing_period’ = ? value for AUTOMICALLY RENEW UNTIL CANCELED

hs_billing_period_start_date = ? value for DUE AT PAYMENT

Thanks

Bruce