cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple requests in the same POST?

Hi all!

 

I just recently started developing against the CIM integration method and have done some research through the forums, documentation and SDK.  I've also already gotten some simple requests working with my project.  The SDK makes things really easy.  

 

I'm wondering, though, if it is possible to bundle requests into a single POST.  The way the SDK classes are broken up, it seems like they are designed for a typical online shopping cart where a user goes through the following process:

  1. creates an acount - create a customer request
  2. registers a card - add a payment profile request
  3. specify their address - add shipping address request
  4. creates a purchase transaction - create AuthandCapture transaction request

That is 4 seperate POSTs to anet.  That makes sense for a typical web user interface because people expect the internet to 'think' when they're setting up their shopping cart.  My process is a little different where all required information will be present when the user initiates the request.  I would like to handle the creation of customer, payment profile, and shipping address all in one POST.  

 

The systems I am using have a firm plugin lifetime of two minutes and other processes unrelated to the POST / response need to happen within that timeframe.  Making 3 POST requests concurrently is not only a waste of time and resources in my case, but I've worked with other APIs that can take up to 30 seconds on similar live account creations.  (Rediculous I know, but it's true)  I would really like to bundle several of these requests into one POST.  Does anyone know if this is possible?

crmGuy
Contributor
1 ACCEPTED SOLUTION

Accepted Solutions

CreateCustomerProfile can do #1,#2, and #3

Then, CreateCustomerProfileTransaction for #4

 

documentation is here.

View solution in original post

RaynorC1emen7
Expert
2 REPLIES 2

CreateCustomerProfile can do #1,#2, and #3

Then, CreateCustomerProfileTransaction for #4

 

documentation is here.

RaynorC1emen7
Expert

You are correct.  CreatePaymentProfileRequest is, in fact, capable of doing the whole thing at once.  What threw me off was the C# code I had been looking at in the SDK has that process broken up into three requests.  My OP failed to mention that I am developing in C#.

 

After tracing the code some more I believe I have found the syntax that will allow me to build this in C# and still use the helper classes.  

 

From CustomerGateway.cs in the C# SDK\CIM:

 

var req = new createCustomerPaymentProfileRequest();
            
req.customerProfileId = profileID;
req.paymentProfile = new customerPaymentProfileType();
req.paymentProfile.payment = new paymentType();

var card = new creditCardType();
if (!String.IsNullOrEmpty(cardCode)) card.cardCode = cardCode;
card.cardNumber = cardNumber;
card.expirationDate = sExpDate;
req.paymentProfile.payment.Item = card;

 

Thanks a lot for the help and fast response!