Associating Multiple Credit Cards when creating Commerce Server Profile using the Commerce Server Profile Adapter for BizTalk

When dealing with Commerce Server integration with BizTalk 2006, one of the requirements that I faced was to create multiple credit cards for a single profile and then link all those credit cards to that profile.
To achieve this, is a two step process. The first step involves creating the actual credit cards on the Commerce Server. This has to be done by independant calls to the Profile Adapter for each credit card. These calls are made with the "EndPoint Message Type" set as "Import Profiles" on the Send Port (either Static or Dynamic).

Once all the credit cards are created, then the profile create message needs to have the list of ids for all the credit cards created. These ids are stored in the Commerce Server SQL database in the following format -

2;<creditcardid1>;<creditcardid2>

Where the creditcard Ids are nothing but GUIDs corresponding to the keys of the actual credit card objects.

Now to send it from the Biztalk Adapter, it should be sent as multiple nodes of the <credit_card_list> type. So in the actual profile create request instead of having a list of credit cards separated by a semi-colon (;) (as might seem from the value stored in the database), each individual credit card Id should be sent as a separate node.

So the create profile request looks similar to this -

<ProfileDocument>

<UserObject>

<GeneralInfo>

<user_id>fc32ccb8-0672-4457-a99d-6ac01c497912</user_id>

<user_name>sanket</user_name>

<email_address>s@b.com</email_address>

......

<credit_card_list>ab3299c1-3d57-44e9-a99d-63451c49340e</credit_card_list>

<credit_card_list>e40234ed-ab7e-1a5c-a99d-6cbe1c49ba91</credit_card_list>

<GeneralInfo>

......................

</UserObject>

</ProfileDocument>

Hope this helps you save some time when dealing with this feature.