I have a site in PHP with AIM integration , which is workign fine.
Now i need ot integrate CIM , in order to allow my users to select their exisitng Payment profile Or tocreate new payment profile.
My site has login feature, which creates the session with userId and the emailAddress. I am using these 2 parameters to fetch the Shipping and Payment profile of the logged in user. I am properly gettign the list of my shipping and Payment profiles. in addition to the existing profiles, I am allowing the user to enter a new card info to create a new Payment profile, if he wants to.
When I submit this info to my backend script , it attempts to do the following :
-Attempts to create a user Profile. if the profile is created successfully, it gives the customerProfileId. If the profile already exists with the same email and customerId , it sends the "duplicate error ...." , which i am parsing and getting the customerProfileId.
So, I have the costomerProfileId , in any case.
Now, I attempt to create the customerPaymentProfile. If this is successfully created, then it will return the customerPaymentProfileId , which i can use to create the payment transaction, But what if the profile is duplicate ? As paymentProfile creation doesn't return the Id of duplicate profile. I can't use the existing profile Id.
What is the best solution for this?
Also I am a bit puzzelled in the steps :
Should i create the Profile first and then proceed with the payment using that profile ?
OR Attempt to process payment first ( using AIM ?) and if payment is successful then create the profile?
Not sure if i shoudl ise AIM and CIM both, or just CIM.
Please advice. Thanks
Solved! Go to Solution.
โ04-21-2015 09:13 PM
โ04-22-2015 01:08 PM - edited โ04-22-2015 01:08 PM
Now, I attempt to create the customerPaymentProfile. If this is successfully created, then it will return the customerPaymentProfileId , which i can use to create the payment transaction, But what if the profile is duplicate ? As paymentProfile creation doesn't return the Id of duplicate profile. I can't use the existing profile Id.
What is the best solution for this?
get the list of their payment profile and compare the last 4 digit. Do it from the latest one first(highest payment profile ID) to use the latest expiration date.
Also I am a bit puzzelled in the steps :
Should i create the Profile first and then proceed with the payment using that profile ?
OR Attempt to process payment first ( using AIM ?) and if payment is successful then create the profile?
Not sure if i shoudl ise AIM and CIM both, or just CIM.
Just use CIM.
โ04-22-2015 04:20 AM
Same is the situation with the duplicate shipping profiles.
If i loop though the exiting Payment Profiles and the Shipping profiles , what are the key fields to match for these profiles.
For the Payment Profiles :
Last four digits of the creditCard->cardNumber
For the Shipping Profiles , Should i match all fields ?
profile->shipToList->firstName
profile->shipToList->lastName
profile->shipToList->address
profile->shipToList->city
profile->shipToList->state
profile->shipToList->zip
profile->shipToList->country
profile->shipToList->phoneNumber
What is the best way?
โ04-22-2015 10:24 AM
โ04-22-2015 01:08 PM - edited โ04-22-2015 01:08 PM