Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adyen Error on paymentMethod #38

Open
mickadoua opened this issue Mar 19, 2021 · 0 comments
Open

Adyen Error on paymentMethod #38

mickadoua opened this issue Mar 19, 2021 · 0 comments

Comments

@mickadoua
Copy link
Collaborator

hello I followed the documentation but i have an error send by the adyen backend with an android phone only

{"status":400,"errorCode":"702","message":"Field \u0027additionalData\u0027 expected to be a Structure but is an Array","errorType":"validation"}

I compare the Payload send from ios and android and found a difference

on android

{
    "additionalData": {},
    "allowedPaymentMethods": [],
    "amount": {
        "currency": "EUR",
        "value": 1500
    },
    "blockedPaymentMethods": [],
    "channel": "Android",
    "countryCode": "FR",
    "merchantAccount": "XXXXX",
    "shopperLocale": "fr-FR",
    "shopperReference": "XXXX"
}

on ios

{
    "countryCode": "FR",
    "shopperReference": "XXX",
    "merchantAccount": "XXXX",
    "amount": {
        "value": 1500,
        "currency": "EUR"
    },
    "shopperLocale": "fr_FR",
    "channel": "iOS"
}

the Logic seems different between the ios / android
on Ios AdyenPayment.swift:58

        if(additionalData != nil){
            let allow3DS2 : Bool = (additionalData?["allow3DS2"] != nil) ? additionalData?["allow3DS2"] as! Bool : false
            let executeThreeD : Bool = (additionalData?["executeThreeD"] != nil) ? additionalData?["executeThreeD"] as! Bool : false
            PaymentsData.additionalData = ["allow3DS2":  allow3DS2,"executeThreeD":executeThreeD]
        }

on Android

                val addt_data_obj : JSONObject = if(detailsResponse.has("additionalData"))  detailsResponse.getJSONObject("additionalData") else JSONObject()

                message.put("resultCode", detailsResponse.getString("resultCode"))
                message.put("merchantReference", detailsResponse.getString("merchantReference"))
                message.put("pspReference", detailsResponse.getString("pspReference"))
                message.put("additionalData", addt_data_obj)


on android the additionalData is not inside a condition.

here my javascript

 paymentDetail = {
  amount: {
    value: amount, //In Multiples of hundred
    currency: 'EUR',
  },
  reference: 'FakeRef', 
  shopperReference: 'xxx',
  shopperEmail: 'xxx',
  channel: Platform.OS === 'ios' ? 'iOS' : 'Android',
  countryCode: app.country.toUpperCase(),
  shopperLocale: 'FR_fr',
  merchantAccount: environment.ADYEN_MERCHANT_ACCOUNT,
  returnUrl:
    Platform.OS === 'ios'
      ? `${environment.PACKAGE_NAME.ios}://`
      : `adyencheckout://${environment.PACKAGE_NAME.android}`,
  additionalData: {
    allow3DS2: true,
    executeThreeD: true,
  }, 

The additionalData variable is present here.

i have 2 questions.

  1. Why additionalData is present on my configuration and not send to /paymentMethods on IOS devices

  2. Why additionalData is empty on android ?

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant