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

Apple Pay Amount 'null' #9

Closed
domtalbot opened this issue Aug 9, 2022 · 5 comments
Closed

Apple Pay Amount 'null' #9

domtalbot opened this issue Aug 9, 2022 · 5 comments

Comments

@domtalbot
Copy link

I'm trying to add ApplePay to my proof of concept, having issues with their not being an amount passed through on the make-payment request. I've scoured through the files to confirm that the amount is being set in config as requested but still it passes through as null.

Confirmed that the standard card integration is still passing through the amount and payments go through fine. It's just apple pay being a pain. Do you have any ideas?

Config:

         const adyenDropIn = AdyenDropIn.setModuleConfig({
            baseUrl: baseUrl,
            debug: true,
            endpoints: {
              makePayment: '/make-payment',
              makeDetailsCall: '/details',
            },
          }).setDropInConfig({
            clientKey: res.data.clientKey,
            environment: 'test', // [test/live]
            countryCode: 'GB',
            amount: {
              value: +data.amount * 100,
              currencyCode: 'GBP',
            },
            applePay: {
              label: 'Purchase',
              amount: {
                value: +data.amount,
                currencyCode: 'GBP',
              },
              configuration: {
                merchantId:
                  '******', // this is correct in app.
              },
            },
          });

Generated request:

POST /api/make-payment?clientKey=test_7LDREFIMKFESDBR5QZCVA37JZUJEYPRW 500 87.781 ms - 689
body {
  amount: null,
  shopperLocale: 'en_US',
  storePaymentMethod: false,
  channel: 'iOS',
  shopperReference: null,
  additionalData: { executeThreeD: true, allow3DS2: true },
  returnUrl: null,
  countryCode: 'GB',
  paymentMethod: { applePayCardNetwork: 'Visa', applePayToken: '', type: 'applepay' }
}
HttpClientException {
  statusCode: 422,
  name: 'HttpClientException',
  message: "HTTP Exception: 422. : Required object 'amount' is not provided.",
  responseHeaders: {
    traceparent: '00-a6b8c97015b24b579d269a54cb7a067a-c40c6d58bf0e1764-01',
    'set-cookie': [
      'JSESSIONID=6D2DC38A12EFE1BABFA259BD68979F99.test3e; Path=/checkout; Secure; HttpOnly'
    ],
    pspreference: 'W9QTRXSXZHHKGK82',
    'content-type': 'application/json;charset=UTF-8',
    'transfer-encoding': 'chunked',
    date: 'Tue, 09 Aug 2022 06:08:48 GMT',
    connection: 'close'
  },
  responseBody: `{"status":422,"errorCode":"100","message":"Required object 'amount' is not provided.","errorType":"validation","pspReference":"W9QTRXSXZHHKGK82"}`,
  errorCode: '100'
}

Response:

[Error: HTTP Exception: 422. : Required object 'amount' is not provided.]
@jesperjohansson
Copy link
Member

Are you running on a physical device? I know Apple Pay doesn't work in simulator and you also need to use Apple Pay Sandbox on your device.

If you are running on device with Apple Pay Sandbox already, run via XCode and check the debug console logs.

If you are still having problems you could check if v1.0.0 of this package works, I think I last tested Apple Pay somewhere around that version.

@domtalbot
Copy link
Author

domtalbot commented Aug 9, 2022

Can confirm, it still does not work on device with sandbox.

However, doing sandbox on device does provide the applePayToken in the request body. It's just the nulled amount which is the problem

-- Edit

By hardcoding the amount in my fake api for make-payment apple pay transactions do go through. Going to take a look at figuring out why the amount value just gets nulled when using apple pay

@domtalbot
Copy link
Author

V1.0.0 yields the same result, still working on tracing why the amount gets nulled. Not too versed in swift so it's not the funnest time :)

@jesperjohansson
Copy link
Member

@domtalbot Hey, if you still need a solution there is a new version v3.0.0 available now which I have confirmed Apple Pay works in. Migration instructions

@domtalbot
Copy link
Author

Thanks for coming back, i did manage to get it working but with some questionable Swift coding. This will be useful.

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

2 participants