Re: Cannot Delete Payments

imfromio
Member

I am creating payment records using the Payments API. I accidentally created a bunch of duplicate payments that are associated to Deals, Line Items, and Contacts. Problem is I cannot delete any of these duplicate payment records. I tried disassociating them from contact and deals, but do not know how to do that with line items.

 

Anyone know how I can delete these payment records?

0 Upvotes
1 Accepted solution
RubenBurdin
Solution
Top Contributor

Hi @imfromio  painful one to discover after a test run with “real” looking data, I know.

 

The key thing here is how those records were created. Payments that come from Commerce Hub processing (HubSpot payments or native Stripe) really cannot be deleted or modified over the API, only refunded/voided and managed in the UI (https://developers.hubspot.com/docs/api-reference/crm-commerce-payments-v3/guide )

 

But payments you create yourself through the Payments API are stored as commerce_payments objects and can be archived programmatically with DELETE /crm/v3/objects/commerce_payments/{commercePaymentId}, which moves them to the recycle bin for 90 days before permanent deletion (https://developers.hubspot.com/docs/api-reference/crm-commerce-payments-v3/basic/delete-crm-v3-objec...

 

If your duplicates were created via the API with a third-party processor, you should not need to manually break every line item link first. HubSpot will drop those associations once the payment object itself is archived. If you really want to clean associations explicitly, you can still use the Associations v4 API to remove links between commerce_payments and line_items before deleting, but that is more of a belt-and-suspenders step than a requirement (https://developers.hubspot.com/docs/api-reference/crm-associations-v4/guide )

 

I would take one duplicate payment, delete it with the commerce payments endpoint, then verify in the UI that the deal and line items look correct before doing it in bulk. If part of the pain here is that duplicate payments originate upstream, Stacksync helps by syncing only normalized, de-duplicated payment records into HubSpot so you do not have to clean up bad objects after the fact.

Did my answer help? Please mark it as a solution to help others find it too.

Ruben Burdin Ruben Burdin
HubSpot Advisor
Founder @ Stacksync
Real-Time Data Sync between any CRM and Database
Stacksync Banner

View solution in original post

0 Upvotes
5 Replies 5
RubenBurdin
Solution
Top Contributor

Hi @imfromio  painful one to discover after a test run with “real” looking data, I know.

 

The key thing here is how those records were created. Payments that come from Commerce Hub processing (HubSpot payments or native Stripe) really cannot be deleted or modified over the API, only refunded/voided and managed in the UI (https://developers.hubspot.com/docs/api-reference/crm-commerce-payments-v3/guide )

 

But payments you create yourself through the Payments API are stored as commerce_payments objects and can be archived programmatically with DELETE /crm/v3/objects/commerce_payments/{commercePaymentId}, which moves them to the recycle bin for 90 days before permanent deletion (https://developers.hubspot.com/docs/api-reference/crm-commerce-payments-v3/basic/delete-crm-v3-objec...

 

If your duplicates were created via the API with a third-party processor, you should not need to manually break every line item link first. HubSpot will drop those associations once the payment object itself is archived. If you really want to clean associations explicitly, you can still use the Associations v4 API to remove links between commerce_payments and line_items before deleting, but that is more of a belt-and-suspenders step than a requirement (https://developers.hubspot.com/docs/api-reference/crm-associations-v4/guide )

 

I would take one duplicate payment, delete it with the commerce payments endpoint, then verify in the UI that the deal and line items look correct before doing it in bulk. If part of the pain here is that duplicate payments originate upstream, Stacksync helps by syncing only normalized, de-duplicated payment records into HubSpot so you do not have to clean up bad objects after the fact.

Did my answer help? Please mark it as a solution to help others find it too.

Ruben Burdin Ruben Burdin
HubSpot Advisor
Founder @ Stacksync
Real-Time Data Sync between any CRM and Database
Stacksync Banner
0 Upvotes
Jaycee_Lewis
Thought Leader

Hey, @suprdense 👋 Thanks for the reply. To add on to what you said, the critical limitation is here — "Payments created through Commerce Hub payment processing (i.e., HubSpot payments or Stripe payment processing) cannot be modified or deleted via this API." – Jaycee 





loop


Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.

Learn More




0 Upvotes
imfromio
Member

Hi @Jaycee_Lewis ,

That's true, but my payment records were created using the API. I am using a third-party payment processor and then using the HubSpot API to create those payemnt records.

0 Upvotes
Jaycee_Lewis
Thought Leader

Thanks for the update. To confirm, you are removing all the associations, including Line Items? Thanks! — Jaycee





loop


Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.

Learn More




0 Upvotes
suprdense
Participant

Hey @imfromio 

You can remove payments created through the Payments API in two ways. Either remove their associations with line items, deals, invoices, or contacts first, then archive or delete the payment. Or delete the payment directly if it is not a real processed transaction.

Start by listing the payment IDs you want to remove. Check what each payment is linked to using the associations API. Remove those associations, especially with line items or invoices. If a payment reflects a real charge, refund it first in HubSpot or through your processor. Then archive or delete the payment record using the commerce payments endpoints.

Always clear associations before deletion to avoid errors. Refund before deletion for real payments. Ensure your private app has write permissions for CRM objects and associations.

0 Upvotes