nonaxanon
nonaxanon

Reputation: 247

correct implementation of payeezy js

I have been reading about the payeezy gateway, and decided to try it, looked up the git hubrepo and tried it . after having to perform various changes to the provided sample.html to get it working, finally was able to get a response with a token, but now I am kind of lost , their documentation suggests to process the payments , to look in this link as you have figured by now, I dont know how to implement that part and would appreciate guidance from here on I have right now -sample.html which contains credit card data and info, including api key, api secret and tokens -succesful token response

Upvotes: 0

Views: 1109

Answers (1)

Rohit
Rohit

Reputation: 106

Here is how to integrate with Java SDK. You may choose any other integration method.

  1. Download the repo https://github.com/payeezy/payeezy_direct_API.git
  2. Extract the “payeezy_java/example” folder.
  3. In Eclipse, go to File->import->Maven->Existing Maven projects->Browse->select example folder->Finish.
  4. Right click the imported project (“firstapi-client”)->”Run As”-> Maven Build ->”clean install”
  5. Add the “firstapi-client” project to your web project as a dependency.
  6. In the servlet you are using to handle the HTTP request, implement the methods – Purchase, Authorize, etc. using the SDK package. For example, this is how to implement a purchase transaction using token

example code:

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String cardType=(String) request.getParameter("cardType");
    String cardHolderName=(String) request.getParameter("cardHolderName");
    String expMonth=(String) request.getParameter("expMonth");
    String expYear=(String) request.getParameter("expYear");
    String payeezyToken=(String) request.getParameter("payeezyToken");
    String amount=(String) request.getParameter(("amount"));
client.setAppId("y6pWAJNyJyjGv66IsVuWnklkKUPFbb0a");   //Your API Key           client.setSecuredSecret("86fbae7030253af3cd15faef2a1f4b67353e41fb6799f576b5093ae52901e6f7"); //Your API secret
    client.setUrl("https://api-cert.payeezy.com/v1");  
    TransactionRequest trequest=new TransactionRequest();
    trequest.setPaymentMethod("token");
    trequest.setAmount(amount);
    trequest.setCurrency("USD");
    trequest.setTransactionType("purchase");
    Token token=new Token();
    Transarmor ta = new Transarmor();
    ta.setValue(payeezyToken);
    ta.setName(cardHolderName);
    ta.setExpiryDt(expMonth+expYear);
    ta.setType(cardType);
    token.setTokenData(ta);
    token.setTokenType("transarmor");
    trequest.setToken(token);
    TransactionResponse tresponse=new TransactionResponse();
tresponse=client.postTokenTransaction(trequest);
}

Upvotes: 1

Related Questions