cancel
Showing results for 
Search instead for 
Did you mean: 

Exception in Integration with Paypal

Highlighted
Contributor

Exception in Integration with Paypal

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,

Tags (1)