Skip to main content
Solved

Release payment failing

  • March 10, 2025
  • 1 reply
  • 26 views

I am trying to release a payment using rest api

  1. I Created invoice by calling put request and was successful and get the reference Nbr
  2. I called release payment object

 

 Payment soPaymentToBeReleased = new Payment
 {
     Type = new StringValue { Value = type },
     ReferenceNbr = new StringValue { Value = paymentRefNo }
 };

created release object

  var releasePayment = new Models.AcumaticaModels.Actions.ReleasePayment(soPaymentToBeReleased);

then I called post request

var token = await acumaticaTokenHelper.GetAccessToken();

using var httpClientPost = new HttpClient();

var requestMessage = new HttpRequestMessage(HttpMethod.Post, "https://acctqa.nabp.pharmacy/entity/NABPR2/24.200.001/Payment/ReleasePayment");

requestMessage.Headers.Add("Accept", "application/json");
requestMessage.Headers.Add("Authorization", $"Bearer {token.AccessToken}");
requestMessage.Headers.Add("PX-CbApiBranch", branch);

requestMessage.Content = new StringContent(JsonConvert.SerializeObject(soPaymentToBeReleased ), null, "application/json");

var response = await httpClientPost.SendAsync(requestMessage);

response.EnsureSuccessStatusCode();

then I receive 400 http code error with message:

The Entity field is required.

any help would be appreciated

Best answer by Dmitrii Naumov

@swassouf could you share the ReleasePayment model code?

Seems like something may be wrong in the way it converts to json object.

 

Also, you can see some examples of C# code for interaction with Acumatica REST API here:

https://github.com/Acumatica/AcumaticaRESTAPIClientForCSharp

View original
Did this topic help you find an answer to your question?

1 reply

Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+7
  • Acumatica Moderator
  • 654 replies
  • Answer
  • March 10, 2025

@swassouf could you share the ReleasePayment model code?

Seems like something may be wrong in the way it converts to json object.

 

Also, you can see some examples of C# code for interaction with Acumatica REST API here:

https://github.com/Acumatica/AcumaticaRESTAPIClientForCSharp


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings