Is there a method for bulk deleting customer profiles? As far as I can tell, we can only delete them one at a time. We have almost 20,000 profiles and are hoping to cull these down by removing profiles with expired payment profiles or no recent history of payment.
11-19-2024 11:30 AM
Hi @zgoldberg ,
Thank you for reaching out with your question regarding bulk deletion of customer profiles in CIM. Currently, there isn't an API method for bulk deleting customer profiles directly. Profiles can only be deleted one at a time using our existing API.
However, I would recommend signing up for Account Updater (AU), which can help manage expired profiles by updating or deleting them automatically.
For bulk deletion, a possible workaround involves developing a utility to handle this process using the existing API endpoint: Delete Customer Profile API. Although direct bulk deletion isn't supported, you can create a script to iterate through customer profiles and delete them one by one.
Here is a basic example of how you might achieve this using a script in Python:
```python
import requests
api_login_id = 'your_api_login_id'
transaction_key = 'your_transaction_key'
customer_profile_ids = ['profile_id_1', 'profile_id_2', ...] # List of profile IDs to delete
def delete_customer_profile(profile_id):
url = 'https://apitest.authorize.net/xml/v1/request.api'
headers = {'Content-Type': 'application/xml'}
body = f"""
<deleteCustomerProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>{api_login_id}</name>
<transactionKey>{transaction_key}</transactionKey>
</merchantAuthentication>
<customerProfileId>{profile_id}</customerProfileId>
</deleteCustomerProfileRequest>
"""
response = requests.post(url, headers=headers, data=body)
return response.status_code, response.text
for profile_id in customer_profile_ids:
status_code, response_text = delete_customer_profile(profile_id)
print(f"Deleted profile {profile_id}: Status Code: {status_code}, Response: {response_text}")
```
Please note that this example is for demonstration purposes. You'll need to handle errors, retries, and possibly rate limits depending on your specific requirements.
If you have any further questions or need more assistance, feel free to reach out.
Best regards,
Authorize.NET Developer Team
11-20-2024 01:28 PM
Hi there,
I totally understand how managing 20,000 customer profiles can be a huge task! Unfortunately, as you've noticed, most systems tend to delete profiles one at a time by default. However, some platforms do offer bulk delete features, though they might not be immediately obvious.
Here’s what I’d recommend:
Hope this helps, and let me know if you need more info!
11-23-2024 05:25 PM