3 posts / 0 new
Last post
harshbhatt6682
Problem with Payeezy payment amount having penny returns - 400 Bad Request, full amount works fine

Hi I'm using payeezy_direct_API-master Java example to integrate Payeezy Direct API in our application.

Issue: when we use amount as 12.33 (with decimal or pennies) it causes - 400 Bad request
E.g TransactionRequest trans = new TransactionRequest();
trans.setTransactionType("purchase");
trans.setPaymentMethod("token");
trans.setAmount("12.34"); //12 Or 1234 works fine
trans.setCurrency("USD");

But when we enter full amount without any decimals/pennies e.g 12 or 30 works perfect.
TransactionRequest trans = new TransactionRequest();
trans.setReferenceNo("ASC Fees");
trans.setTransactionType("purchase");
trans.setPaymentMethod("token");
trans.setAmount("30");
trans.setCurrency("USD");

Example of Input JSON Request
---------------------------------
sz4F7ou1BB3VCBAn9A2tAxoxgPBAHDLY33175594605148615941457643933480fdoa-a480ce8951daa73262734cf102641994c1e55e7cdf4c02b6{"transaction_type":"PURCHASE","merchant_ref":"ASC Fees","method":"token","amount":"12.34","currency_code":"USD","token":{"token_type":"FDToken","token_data":{"type":"visa","cardholder_name":"PISD Parent","exp_date":"1230","value":"2537446225198291"}}}

Output with error and it's consistent if you put "." as $ amount
-----------------------------------------------------------------
org.springframework.web.client.HttpClientErrorException: 400 Bad Request
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:88)
at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:556)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:514)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:472)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:420)
at com.firstdata.firstapi.client.FirstAPIClientV2Helper.doPrimaryTransaction(FirstAPIClientV2Helper.java:325)
at com.firstdata.firstapi.client.FirstAPIClientV2Helper.authorizeTransaction(FirstAPIClientV2Helper.java:526)
at com.firstdata.firstapi.client.TEAMSFirstDataAPIClientV22Test.doAuthorizePayment(TEAMSFirstDataAPIClientV22Test.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

I couldn't find any other thread/forum having similar issue, that's posting new one.

Appreciate you help!
Thanks!


rohitrajagopal3538
Re: Problem with Payeezy payment amount having penny returns ...

Harsh - The amount should be entered in cents. Decimals are not allowed in the amount field and so you are running into errors. For example, if you want to charge $12.50, then amount should be 1250.

Hope this helps.

Regards,

Payeezy team


harshbhatt6682
Re: Problem with Payeezy payment amount having penny returns ...

Ohh that solved the problem.
I couldn't find or missed that it's cents not $ amount.

Thanks for your prompt reply!