Authorize.net CIM - How to delete a customer profile from Authorize.net CIM
In my project i am creating customer profile (Not a payment profile) in Authorize.net (CIM) for each user registration, i have successfully implemented that. but i have to delete these customer profiles (Not a payment profile) dynamically i.e when Site admin deleting each user from this project, have to delete customer profi开发者_高级运维le from Authorize.net merchant account.
Please anyone help me!!!!
As per the Authorize.Net CIM XML Guide use the deleteCustomerProfileResponse API call on page 57:
This function is used to delete an existing customer profile along with all associated customer payment profiles and customer shipping addresses.
<?xml version="1.0" encoding="utf-8"?>
<deleteCustomerProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>YourUserLogin</name>
<transactionKey>YourTranKey</transactionKey>
</merchantAuthentication>
<customerProfileId>10000</customerProfileId>
</deleteCustomerProfileRequest>
Well there must be a function that will delete the Customer Profile ID But If you want to delete customer payment Profile then use this method in C#
public string DeleteCustPmtProfId(Int64 custProfID, Int64 custPmtProfID)
{
CustomerProfileWS.DeleteCustomerPaymentProfileResponseType response = SoapAPIUtilities.Service.DeleteCustomerPaymentProfile(SoapAPIUtilities.MerchantAuthentication, custProfID, custPmtProfID);
for (int i = 0; i < response.messages.Length; i++)
{
lblStatus.Text = lblStatus.Text + "<br/>Message: " + response.messages[i].text + "<br/>Response Code: " + response.resultCode + "<br/>";
}
}
Deleting customer profile can delete all the associated payment profile and shipping address profile as well. You can use the following, this will definitely works.
$xml = new AuthnetXML(AUTHNET_LOGIN, AUTHNET_TRANSKEY, AuthnetXML::USE_DEVELOPMENT_SERVER);
$xml->deleteCustomerProfileRequest(array(
'customerProfileId' => '5427896'
));
Originally Referenced from: https://github.com/stymiee/Authorize.Net-XML/blob/master/examples/cim/deleteCustomerProfileRequest.php
精彩评论