cancel
Showing results for 
Search instead for 
Did you mean: 
MuhammadSakib
Occasional Member - Level 1

Close Payment Batch Synchronously not working properly

Hi,
I am new to SAP Concur Expense service. I am trying to close Payment Batches by calling the Concur API through my ASP.NET C# project. I am trying to do this in 3 steps by following the documentation 
(https://developer.concur.com/api-reference/expense/payment-batch/v1.payment-batches.html#closepaymen...

 

  1. Close a Payment Batch Asynchronously ( POST /api/expense/paymentbatch/v1.2/batch/{BatchID}/close )
  2. Then close the Payment Batch Synchronously ( POST /api/expense/paymentbatch/v1.1/batch/{BatchID}/close )
  3. Finally, Retrieve the Payment Batch File ( By calling the File-Url returned by the Close Batches 1.1 API response from the 2nd step )

Sometimes, I face problems from step 2 (Close Payment Batch Synchronously). In this step, I don't get any successful response (response doesn't contain file URL), but the Payment Batch status changes and shows CLOSED. I can get SUCCESS status when I call the same API multiple times (2-10 times). 

 

Following are the two ways I tried to perform step 2:

string url = "{UrlPrefix}/api/expense/paymentbatch/v1.1/batch/{batchId}/close";
Client = new HttpClient(); //HttpClient declared globally
Client.DefaultRequestHeaders.Accept.Clear();
Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", {accessToken});
var body = new List<KeyValuePair<string, string>>();
HttpContent content = new FormUrlEncodedContent(body);
HttpResponseMessage postResponse = await Client.PostAsync(url, content);

or,

string url = "{UrlPrefix}/api/expense/paymentbatch/v1.1/batch/{batchId}/close";
HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Post, url);
requestMessage.Headers.Add("Authorization", "Bearer " + {accessToken});
requestMessage.Headers.Add("Accept", "application/json");
HttpResponseMessage postResponse = await Client.SendAsync(requestMessage); //HttpClient Client = new HttpClient() declared globally

 

In both scenarios, sometimes I get [postResponse.IsSuccessStatusCode = false] response. I tried to find the root cause of this problem but didn't find any.

 

If anyone has faced the same problem or knows any solution to the problem, please let me know.

1 REPLY 1
KevinD
Community Manager
Community Manager

@MuhammadSakib I suggest posting this in the User Admin Group. This forum leans more towards end users and not site administrators. The User Admin Group is only site administrators that might have experience with your issue. 

 

If you are not a member of the User Admin Group, go to the group and use the Request to Join link. You must have site admin permissions or be an Authorized Support Contact to be admitted into the group.


Thank you,
Kevin Dorsey
SAP Concur Community Manager
Did this response answer your question? Be sure to select “Accept as Solution” so your fellow community members can be helped by it as well.