payment gateway - Paypal payement failure in test account in java -
i trying develop application in paypal dodirectpayment method creating testing sandbox account , use following code own api credentials acknowledgement failure ...
if 1 know how rid out issue share me.,
thanks in advance.
public class dodirectpayment { private nvpcallerservices caller = null; public string dodirectpaymentcode(string paymentaction,string amount,string cardtype, string acct,string expdate,string cvv2, string firstname, string lastname, string street, string city, string state, string zip, string countrycode) { nvpencoder encoder = new nvpencoder(); nvpdecoder decoder = new nvpdecoder(); try { caller = new nvpcallerservices(); apiprofile profile = profilefactory.createsignatureapiprofile(); /* warning: not embed plaintext credentials in application code. doing insecure , against best practices. api credentials must handled securely. please consider encrypting them use in production environment, , ensure authorized individuals may view or modify them. */ // set api credentials, paypal end point, api operation , version. profile.setapiusername("sdk-three_api1.sdk.com"); profile.setapipassword("qfzcwn5hzm8vbg7q"); profile.setsignature("avgidzosqigwu.lgj3z15hlczxaaack6imhawrjefqgclvwbe8imgchz"); profile.setenvironment("sandbox"); profile.setsubject(""); caller.setapiprofile(profile); encoder.add("version", "51.0"); encoder.add("method","dodirectpayment"); // add request-specific fields request string. encoder.add("paymentaction",paymentaction); encoder.add("amt",amount); encoder.add("creditcardtype",cardtype); encoder.add("acct",acct); encoder.add("expdate",expdate); encoder.add("cvv2",cvv2); encoder.add("firstname",firstname); encoder.add("lastname",lastname); encoder.add("street",street); encoder.add("city",city); encoder.add("state",state); encoder.add("zip",zip); encoder.add("countrycode",countrycode); // execute api operation , obtain response. string nvprequest = encoder.encode(); string nvpresponse =(string) caller.call(nvprequest); decoder.decode(nvpresponse); } catch(exception ex) { ex.printstacktrace(); } return decoder.get("ack"); } public static void main(string[] args) { dodirectpayment obj=new dodirectpayment(); system.out.println(obj.dodirectpaymentcode("authorization ", "1", "visa", "1234123412341234", "122012", "123", "testname", "testname", "chennai", "chennai", "tx", "77570", "us")); } }
you have typo in paymentaction parameter: "authorization " should replaced "authorization" (just remove redundant space @ end)
Comments
Post a Comment