Exception in Integration with Paypal

RJ20
Contributor
Contributor

Hi,

I am integrating Paypal rest api with my application.When I am setting the PayerInfo details to the Payer object I am getting exception which I am unable to find the exact reason.

Please find the sample code and the exception that I am getting below

=================================================================

        Payer payer = new Payer();
        payer.setPaymentMethod(method.toString());
        PayerInfo pi = new PayerInfo();
        pi.setBuyerAccountNumber("2345");
        Address adress = new Address();
        adress.setCity("Kollam");
        adress.setPostalCode("695581");
        pi.setBillingAddress(adress);<[Removed. Phone #s not permitted]");
        pi.setCountryCode("IN");
        pi.setEmail("am at m.com")
        pi.setExternalRememberMeId("369874");
        pi.setFirstName("FName");
        pi.setLastName("LName");        
        pi.setMiddleName("MName");
        pi.setPayerId("LCJ65SJX8");
        pi.setPhone[Removed. Phone #s not permitted]);
        pi.setPhoneType("HOME");        
        pi.setSalutation("Mr");                
        ShippingAddress sa = new ShippingAddress();
        sa.setRecipientName("Cory");
        sa.setCity("City");
        sa.setCountryCode("IN");
        sa.setLine1("line1");
        sa.setLine2("line 2");
        sa.setPhone("1234-345-678");
        sa.setPostalCode("695581");
        sa.setRecipientName("B");
        pi.setShippingAddress(sa);
        pi.setSuffix("Suffix");
        pi.setTaxId("123");
        pi.setTaxIdType("BR_CPF");        
        payer.setPayerInfo(pi);

=====================================

Exception

=====================================

Response code: 400    Error response: {"name":"MALFORMED_REQUEST","message":"Incoming JSON request does not map to API request","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#MALFORMED_REQUEST","debug_id":"#######"}

 

Any suggestion would be of great help.

 

Thank You,

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.