APIs & Integrations

JDavisT
Member

Line items and associations to Payment Links

SOLVE

Hello, I have a use case which is very frustrating.


We set up Payment Links for customers to purchase our products.  We may set up various Payment Links based on bundles or campaigns; these contain Line Items which be copied from the same Product. All good so far.

 

 

My issue started when we began to replace/update some of our Products and we wanted to created new Line Items - I don't have a good way to figure out which Payment Links need their Line Items updated.


ISSUE: there doesn't appear to be a way to obtain the line item number from a Payment Link, or vice-versa, whihc is very bizarre since they are obviously associated in the GUI.

 

Despite https://api.hubapi.com/crm/v3/schemas/line_items list them as asscioated:
```
...
"assocations": [
...
{
"fromObjectTypeId": "0-8",
"toObjectTypeId": "0-118",
"name": "LINE_ITEM_TO_PAYMENT_LINK",
"cardinality": "ONE_TO_ONE",
"inverseCardinality": "ONE_TO_MANY",
"hasUserEnforcedMaxToObjectIds": false,
"hasUserEnforcedMaxFromObjectIds": false,
"maxToObjectIds": 1,
"maxFromObjectIds": 50000,
"id": "759",
"createdAt": null,
"updatedAt": null
},
{
"fromObjectTypeId": "0-118",
"toObjectTypeId": "0-8",
"name": "PAYMENT_LINK_TO_LINE_ITEM",
"cardinality": "ONE_TO_MANY",
"inverseCardinality": "ONE_TO_ONE",
"hasUserEnforcedMaxToObjectIds": false,
"hasUserEnforcedMaxFromObjectIds": false,
"maxToObjectIds": 50000,
"maxFromObjectIds": 1,
"id": "758",
"createdAt": null,
"updatedAt": null
},
```

Nothing ever shows up:

https://api.hubapi.com/crm/v4/objects/payment_link/5384832/associations/line_items

```

"status": "error",
"message": "The scope needed for this API call isn't available for public use. If you have questions, contact support or post in our developer forum."
```

`https://api.hubapi.com/crm/v4/objects/line_items/34024136239/associations/payment_link` results in
```
{
"results": []
}
```


And despite https://api.hubapi.com/crm/v3/properties/line_item show 'payment_link',
All results here have payment_link and hs_url set to Null:

https://api.hubapi.com/crm/v4/objects/line_items?limit=100&properties=payment_link?properties=hs_url

For some reason, https://api.hubapi.com/crm/v3/objects/line_items/search allows property 'hs_url' to show up but, payment_link is always blank still. 

The hs_url from search is techinically enough information with which to manually proceed, but to pour salt on the wound, that URL can't be inspected via the GUI https://app.hubspot.com/payment-links/***, without manually copying the link for each one, AND all of the payment link search/listing endpoints give me the error "not available for public use".

Please help!

 

0 Upvotes
1 Accepted solution
nickdeckerdevs1
Solution
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

Line items and associations to Payment Links

SOLVE

This is a tough one. Not having that association publically available is another half implemention of these newer objects that are being created. I feel for you and I hope that this stuff get's moved forward and becomes publically available.

Here are a few ideas -- I'm just going to be brief, some of them may require more explaining or testing, so let me know if one interests you and you would like to dig in more. I am not super familiar with payment links and how they are being set up (I used them a few times and they don't meet the needs of most use cases I had for them) -- so 😛 maybe I'm out of touch

Create a spreadsheet and keep track of this. Simple, effective, not going to help the older stuff.

 

Get into the dev tools on these pages and inspect the items. It is entirely possible that you might be able to run a script in the console that allows you to extract some of this data. I do this often inside different aspects of HubSpot -- like to get all the edit page urls in website and landing pages. 

Do payment links create payments? Is it possible to export out payment records and find this information?

And then finally, and I'm not sure I know what you are trying to do with these
----------------------------------------------------------------------------------------
For some reason, https://api.hubapi.com/crm/v3/objects/line_items/search allows property 'hs_url' to show up but, payment_link is always blank still. 

The hs_url from search is techinically enough information with which to manually proceed, but to pour salt on the wound, that URL can't be inspected via the GUI https://app.hubspot.com/payment-links/***, without manually copying the link for each one, AND all of the payment link search/listing endpoints give me the error "not available for public use".

----------------------------------------------------------------------------------------

I would export records to a csv, export that to a json object and set up a local script that runs through this data, does the searches you have in here, then generates the urls for these, and save that as a csv file. Load that into google sheets, create a quick app script that opens every link on a 500ms delay...

That would open all of the links, I'm not sure if that is what you are trying to do lol

This may be of no help...

View solution in original post

4 Replies 4
nickdeckerdevs1
Solution
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

Line items and associations to Payment Links

SOLVE

This is a tough one. Not having that association publically available is another half implemention of these newer objects that are being created. I feel for you and I hope that this stuff get's moved forward and becomes publically available.

Here are a few ideas -- I'm just going to be brief, some of them may require more explaining or testing, so let me know if one interests you and you would like to dig in more. I am not super familiar with payment links and how they are being set up (I used them a few times and they don't meet the needs of most use cases I had for them) -- so 😛 maybe I'm out of touch

Create a spreadsheet and keep track of this. Simple, effective, not going to help the older stuff.

 

Get into the dev tools on these pages and inspect the items. It is entirely possible that you might be able to run a script in the console that allows you to extract some of this data. I do this often inside different aspects of HubSpot -- like to get all the edit page urls in website and landing pages. 

Do payment links create payments? Is it possible to export out payment records and find this information?

And then finally, and I'm not sure I know what you are trying to do with these
----------------------------------------------------------------------------------------
For some reason, https://api.hubapi.com/crm/v3/objects/line_items/search allows property 'hs_url' to show up but, payment_link is always blank still. 

The hs_url from search is techinically enough information with which to manually proceed, but to pour salt on the wound, that URL can't be inspected via the GUI https://app.hubspot.com/payment-links/***, without manually copying the link for each one, AND all of the payment link search/listing endpoints give me the error "not available for public use".

----------------------------------------------------------------------------------------

I would export records to a csv, export that to a json object and set up a local script that runs through this data, does the searches you have in here, then generates the urls for these, and save that as a csv file. Load that into google sheets, create a quick app script that opens every link on a 500ms delay...

That would open all of the links, I'm not sure if that is what you are trying to do lol

This may be of no help...

JDavisT
Member

Line items and associations to Payment Links

SOLVE

Ok so the dev tools trick does work to find the URLs all in one place. In theory this should be enough information for me to map out all payment links and ascertain which need to be redone.  Thanks

0 Upvotes
nickdeckerdevs1
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

Line items and associations to Payment Links

SOLVE

If you get a workable script would you mind sharing it in a code block or a gist so that we can have this documented for future viewers?

0 Upvotes
DianaGomez
Community Manager
Community Manager

Line items and associations to Payment Links

SOLVE

Hi @JDavisT,

 

Thanks for reaching out to the Community!

 

I would like to invite some members of our community who may offer valuable insights.— hey @nickdeckerdevs1, @HubDoPete, @SteveHTM  - Could you share your advice with @JDavisT?

 

Thanks for taking a look!

Diana

0 Upvotes