paypal-android icon indicating copy to clipboard operation
paypal-android copied to clipboard

INVALID_PARAMETER_SYNTAX

Open JackZhangdaye opened this issue 7 months ago • 8 comments

PayPal Android SDK Version

2.0.0

Environment

Sandbox

Android Version & Device

android 15

PayPal dependencies

paypalWeb = { group = "com.paypal.android",name = "paypal-web-payments", version.ref = "paypalWeb" } paypalCard = { group = "com.paypal.android",name = "card-payments", version.ref = "paypalCard" }

Describe the bug

{"error":{"code":400,"correlationId":"f353461aa7d11","errorDescription":"Request is not well-formed, syntactically incorrect, or violates schema. -\u003e [Issue: INVALID_PARAMETER_SYNTAX.\nError description: The value of a field does not conform to the expected format., Issue: INVALID_PARAMETER_SYNTAX.\nError description: The value of a field does not conform to the expected format., Issue: INVALID_PARAMETER_SYNTAX.\nError description: The value of a field does not conform to the expected format., Issue: INVALID_STRING_LENGTH.\nError description: The value of a field is either too short or too long.]","detailMessage":"Error: 400 - Description: Request is not well-formed, syntactically incorrect, or violates schema. -\u003e [Issue: INVALID_PARAMETER_SYNTAX.\nError description: The value of a field does not conform to the expected format., Issue: INVALID_PARAMETER_SYNTAX.\nError description: The value of a field does not conform to the expected format., Issue: INVALID_PARAMETER_SYNTAX.\nError description: The value of a field does not conform to the expected format., Issue: INVALID_STRING_LENGTH.\nError description: The value of a field is either too short or too long.]","stackTrace":[]}}

To reproduce

private void startPayCard(){
    CoreConfig coreConfig = new CoreConfig(AppUtils.clientID, Environment.SANDBOX);
    CardClient cardClient = new CardClient(PaymentInformationActivity.this,coreConfig);
    Card card = new Card("5110921167937625","08","2028","409");
    CardRequest cardRequest = new CardRequest("5C526682L5077981L", card, "com.earth.ffzo.paypal");
    cardClient.approveOrder(cardRequest, new CardApproveOrderCallback() {
        @Override
        public void onCardApproveOrderResult(@NonNull CardApproveOrderResult cardApproveOrderResult) {
            Log.i(TAG, "onCardApproveOrderResult: "+new Gson().toJson(cardApproveOrderResult));

//{"error":{"code":400,"correlationId":"f353461aa7d11","errorDescription":"Request is not well-formed, syntactically incorrect, or violates schema. -\u003e [Issue: INVALID_PARAMETER_SYNTAX.\nError description: The value of a field does not conform to the expected format., Issue: INVALID_PARAMETER_SYNTAX.\nError description: The value of a field does not conform to the expected format., Issue: INVALID_PARAMETER_SYNTAX.\nError description: The value of a field does not conform to the expected format., Issue: INVALID_STRING_LENGTH.\nError description: The value of a field is either too short or too long.]","detailMessage":"Error: 400 - Description: Request is not well-formed, syntactically incorrect, or violates schema. -\u003e [Issue: INVALID_PARAMETER_SYNTAX.\nError description: The value of a field does not conform to the expected format., Issue: INVALID_PARAMETER_SYNTAX.\nError description: The value of a field does not conform to the expected format., Issue: INVALID_PARAMETER_SYNTAX.\nError description: The value of a field does not conform to the expected format., Issue: INVALID_STRING_LENGTH.\nError description: The value of a field is either too short or too long.]","stackTrace":[]}}

        }
    });
}

Expected behavior

I couldn't find the reason for the error. Please give me some guidance. Thank you

Screenshots

No response

JackZhangdaye avatar Jul 22 '25 09:07 JackZhangdaye

Hi @JackZhangdaye thanks for using the PayPal SDK for Android. I tried to reproduce this error in our Demo app with the same card credentials in Sandbox. On my end, the card approval succeeds when creating an Order with an AUTHORIZE intent.

Have you tried other test cards to see if the same error occurs?

sshropshire avatar Jul 22 '25 16:07 sshropshire

I have tried generating new test cards, new orderIds, and creating new projects to reconnect to the SDK, and the same problem always occurs. However, there are no problems using the same test cards and orderIds on the iOS side, and there are no problems using the web SDK.

JackZhangdaye avatar Jul 23 '25 05:07 JackZhangdaye

CoreConfig coreConfig = new CoreConfig("AYj0tnzswRJq9qFutpNX-VtSNh0gmKlfCBNJgqU-ptR6twSDaYZ_RkCGEpyfKMCKxqEiO-gl-ryLLimj", Environment.SANDBOX); CardClient cardClient = new CardClient(WelcomeActivity.this,coreConfig); Card card = new Card("4032039754892141","07","2028","893"); CardRequest cardRequest = new CardRequest("73F6408408448572H", card, "com.earth.ffzo"); cardClient.approveOrder(cardRequest, new CardApproveOrderCallback() { @Override public void onCardApproveOrderResult(@NonNull CardApproveOrderResult cardApproveOrderResult) { Log.i(TAG, "onCardApproveOrderResult: "+cardApproveOrderResult); //onCardApproveOrderResult: Failure(error=com.paypal.android.corepayments.PayPalSDKError: Error: 400 - Description: Request is not well-formed, syntactically incorrect, or violates schema. -> [Issue: INVALID_PARAMETER_SYNTAX. //Error description: The value of a field does not conform to the expected format., Issue: INVALID_PARAMETER_SYNTAX. //Error description: The value of a field does not conform to the expected format.]) } });


This is the result of my latest test, can you help me take a look? Thank you

JackZhangdaye avatar Jul 23 '25 06:07 JackZhangdaye

@JackZhangdaye if it works on iOS and Web I feel like it should work on Android. Have you double checked that the ClientId you're using matches the one expected on the server side?

sshropshire avatar Jul 23 '25 15:07 sshropshire

     CoreConfig coreConfig = new CoreConfig("AYj0tnzswRJq9qFutpNX-VtSNh0gmKlfCBNJgqU-ptR6twSDaYZ_RkCGEpyfKMCKxqEiO-gl-ryLLimj", Environment.SANDBOX);

            CardClient cardClient = new CardClient(WelcomeActivity.this,coreConfig);
            Card card = new Card("4032039754892141","07","2028","893");
            CardRequest cardRequest = new CardRequest("1KD135528B5814015", card, "com.earth.ffzo.paypal");
            cardClient.approveOrder(cardRequest, new CardApproveOrderCallback() {
                @Override
                public void onCardApproveOrderResult(@NonNull CardApproveOrderResult cardApproveOrderResult) {
                    Log.i(TAG, "onCardApproveOrderResult: "+cardApproveOrderResult);
                }
            });
            PayPalWebCheckoutClient checkoutClient = new PayPalWebCheckoutClient(WelcomeActivity.this, coreConfig, "com.earth.ffzo.paypal");
            checkoutClient.start(WelcomeActivity.this,new PayPalWebCheckoutRequest("1KD135528B5814015", PayPalWebCheckoutFundingSource.PAYPAL));

The project has access to the Web SDK, and the Web is fine, using the same Client ID.

Android Studio Ladybug | 2024.2.1 Patch 3 distributionUrl=https://services.gradle.org/distributions/gradle-8.10-bin.zip JDK 20.0.1

I don't know where to look for problems.

JackZhangdaye avatar Jul 24 '25 01:07 JackZhangdaye

@JackZhangdaye can you open the App Inspection panel in Android studio and share the raw JSON request body that the SDK sends when CardClient.approveOrder() is called?

sshropshire avatar Jul 24 '25 14:07 sshropshire

@sshropshire url=https://api-m.sandbox.paypal.com/v2/checkout/orders/0NS9672804790552A/confirm-payment-source No JSON data found.

But I found that the Authorization: Basic... printed on my AS is inconsistent with the paypal document {https://developer.paypal.com/docs/api/orders/v2/#orders_confirm}, I don't know if this is the reason. I have created a new project, can you help me take a look at it in detail? Thank you very much for your help {https://github.com/JackZhangdaye/paypal_demo}.

JackZhangdaye avatar Jul 25 '25 05:07 JackZhangdaye

Ok

christiancoleman30 avatar Sep 11 '25 20:09 christiancoleman30