APIs & Integrations

Pb8
Member

Unable to retrieve specific properties from line item

First, I am pulling a deal and it's associations.

$properties = ['dealname', 'dealstage', 'term_end', 'closedate', 'hubspot_owner_id', 'pipeline', 'amount', 'type_of_product', 'inquiry_source', 'wo_number', 'dealtype'];
    $associations = ['task', 'quote', 'company', 'contact', 'ticket', 'products', 'line_item'];
    $deal_id = '12345';
    
    try {
        $apiResponse = $client->crm()->deals()->basicApi()->getById($deal_id, $properties, false, $associations);
    } catch (ApiException $e) {
        echo "Exception when calling basic_api->get_by_id: ", $e->getMessage();
    }

Once I retrieve the deal, I am then reading an individual line item.

$line_properties = [
        'name', 
        'hs_sku', 
        'hs_recurring_billing_start_date', 
        'hs_recurring_billing_period', 
        'recurringbillingfrequency', 
        'quantity', 
        'price', 
        'discount', 
        'net_price', 
        'hs_mrr', 
        'hs_arr',
        'hs_product_id'
    ];

    try {
        $apiResponse = $client->crm()->lineItems()->basicApi()->getById('567890', $line_properties, false);
    } catch (ApiException $e) {
        echo "Exception when calling basic_api->get_by_id: ", $e->getMessage();
    }

This issue is that some properties that are filled out on the Hubspot line item are coming back as null.

1. Billing Start Date is set to "At Payment".  In the API Response it is returning hs_recurring_billing_start_date => NULL 

2. Term (Months) is set to 0. In the API Response it is returning hs_recurring_billing_period => NULL 

3. Billing Frequency is set to "One-time". In the API Response it is returning recurringbillingfrequency => NULL 

 

Why is it returning NULL only for these properties and how do I fix this?

 

Thanks

0 Upvotes
1 Reply 1
Jaycee_Lewis
Community Manager
Community Manager

Unable to retrieve specific properties from line item

Hey, @Pb8 👋 Thanks for your question. I am happy to have a look and see if I can reproduce the issue on my end.

 

A few questions:

  • Is this happening for custom as well as default Product properties? Or just the default ones?

  • Are these subscription-type or one-time type line items?

  • Can you confirm if the same issue occurs with other deals and line items, or is it specific to a certain deal or line item? 

     

For my second question, I ask because, recurring billing (hs_recurring_billing_start_date, hs_recurring_billing_period) and recurringbillingfrequency should be associated with subscription-type products, not one-time products. If 'Billing Frequency' is set to 'One-time', these fields might indeed be null.

 

Furthermore, it might be worth verifying the IDs and ensuring that they correspond to the correct deals and line items in your HubSpot portal.

 

Thank you! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes