INVALID_PARAMETER_SYNTAX
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
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?
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.
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 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?
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 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 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}.
Ok