0
votes

I am using PayPal REST API with Visual Studio 2015. I am getting a 'malformed request' on my Sandbox paying with a paypal stored ccard (passing a token to the paypal api). Debug ID:5b98f22095ba7

How do I capture the request as it is submitted to PayPal, so I can compare that with the expected request format? Alternately, can someone point me to a tool that will give me detail on my debug ID?

Thanks!

?details {PayPal.Api.Details} fee: "0.00" gift_wrap: "0.00" handling_fee: "0.00" insurance: "0.00" shipping: "0.00" shipping_discount: "0.00" subtotal: "55.00" tax: "2.75"

?paypalItem {PayPal.Api.Item} category: null currency: "CAD" description: "Individual Lesson" height: null length: null name: "LetsRide: Individual Lesson" postback_data: null price: "55.00" quantity: "1" sku: "1" supplementary_data: null tax: "2.75" url: null weight: null width: null ?amnt {PayPal.Api.Amount} currency: "CAD" details: {PayPal.Api.Details} total: "57.75" ?pInfo {PayPal.Api.PayerInfo} billing_address: null birth_date: null buyer_account_number: null country_code: null email: null external_remember_me_id: null first_name: "Test" last_name: "User" middle_name: null payer_id: "test" phone: null phone_type: null salutation: null shipping_address: null suffix: null tax_id: null tax_id_type: null ?payr {PayPal.Api.Payer} account_age: null account_type: null external_selected_funding_instrument_type: null funding_instruments: Count = 1 funding_option: null funding_option_id: null payer_info: {PayPal.Api.PayerInfo} payment_method: "credit_card" related_funding_option: null status: null ?phn {PayPal.Api.Phone} country_code: "+1" extension: null national_number: "3066920xxx" // redacted {PayPal.Api.Payee} email: "valid email adress - redacted" merchant_id: "valid merchant id - redacted" phone: null

?payment {PayPal.Api.Payment} billing_agreement_tokens: null cart: null create_time: null experience_profile_id: null failed_transactions: null failure_reason: null id: null intent: "sale" links: null note_to_payer: null payee: {PayPal.Api.Payee} payer: {PayPal.Api.Payer} payment_instruction: null redirect_urls: null state: null token: null transactions: Count = 1

update_time: null

               intentStr = "sale";

                // Now create Payer object and assign the fundinginstrument list to the object
                PayerInfo pInfo = new PayerInfo();
                pInfo.first_name = orderMaster.FirstName;
                pInfo.last_name = orderMaster.LastName;
                pInfo.payer_id = user.UserName;
                Payer payr = new Payer();
                payr.payer_info = pInfo;
                payr.funding_instruments = CreatePayPalFundingInstrumentList(PPCCToken);
                payr.payment_method = "credit_card";
                Phone phn = new Phone();
                phn.country_code = "+1";
                phn.national_number = userCompany.paypalPhone;
                Payee pyee = new Payee();
                pyee.email = userCompany.paypalEmail;
                pyee.merchant_id = userCompany.paypalMerchantId;

                // finally create the payment object and assign the payer object & transaction list to it
                payment = new Payment()
                {
                    intent = intentStr,    // `sale` or `authorize`
                    payer = payr,
                    payee = pyee,
                    transactions = GetTransactionsList(orderMaster)
                };
1
Were you able to intercept the payload being sent with Fiddler?mjwills
Thanks mj - I have not worked with Fiddler before, but will definitely invest some time to try to learn how to use it!Jan F

1 Answers

2
votes

Self-solved: I removed the 'payee = pyee' section that I created for third party payments, and I received a clearer error message from the paypal api. The error was related to the test credit card I was using, not supporting CAD currency!!

Man - spend two days trying to debug code!!!!!

Captured a different test credit card in the vault, and problem solved!

Wish paypal could be clearer with their messaging on an error! Or - give developers access to the Debug ID detail.