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

when first init payment view, always "option not available" #146

Open
GengJian opened this issue Jul 5, 2022 · 1 comment
Open

when first init payment view, always "option not available" #146

GengJian opened this issue Jul 5, 2022 · 1 comment

Comments

@GengJian
Copy link

GengJian commented Jul 5, 2022

Describe the bug
A clear and concise description of what the bug is.

image
when I first request clientToken and initialize the paymentview,sometimes it tells me option not available -.-

onInitialized and onErrorOccurred will be called ..

the same order,try again maybe is fine...

LOG is “ShowFormFalseError”

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Device and version:

  • Device: [e.g. iPhone6]
  • OS version: [e.g. Android 11]
  • Klarna In-App SDK version [2.1.8]

Merchant Name
Please state the merchant's name and the application's name that is facing the issue using the SDK.

Impact Level
What is the impact level of this bug on the merchant and its customers? Is it happening in production? Is it a blocking issue for development? etc.

Additional context
Add any other context about the problem here.

I/chromium: [INFO:CONSOLE(10)] "Error performing Klarna.Payments.load(). ShowFormFalseError: Show form set to false.", source: file:///data/user/0/com.xxxx.android/files/kp_index.html?mockkp=true&storeall=true&loglevel=0&endpoint=aws (10)
I/chromium: [INFO:CONSOLE(10)] "Sending message:
{
"action": "actionToNative",
"sender": "KlarnaPaymentsWrapper",
"receiver": "Native",
"params": {
"actionType": "errorResponse",
"error": "ShowFormFalseError",
"message": "Error performing Klarna.Payments.load().",
"isPublic": "true",
"isFatal": "true",
"action": "Load"
},
"messageId": "esQJCp2FvV"
}", source: file:///data/user/0/com.xxxx.android/files/kp_index.html?mockkp=true&storeall=true&loglevel=0&endpoint=aws (10)
D/PurchaseKlarnaActivity: Klarna onErrorOccurred...
KlarnaPaymentsSDKError(name=ShowFormFalseError, message=Error performing Klarna.Payments.load()., isFatal=true, action=Load, invalidFields=null)
I/chromium: [INFO:CONSOLE(10)] "New dimensions found: [object ResizeObserverEntry]", source: file:///data/user/0/com.xxxx.android/files/kp_index.html?mockkp=true&storeall=true&loglevel=0&endpoint=aws (10)
I/chromium: [INFO:CONSOLE(10)] "Sending message:
{
"action": "heightChanged",
"sender": "KlarnaPaymentsWrapper",
"receiver": "Native",
"params": {
"height": "123.265625"
},
"messageId": "f4mlIRztz7"
}", source: file:///data/user/0/com.xxxx.android/files/kp_index.html?mockkp=true&storeall=true&loglevel=0&endpoint=aws (10)
I/chromium: [INFO:CONSOLE(10)] "Container size changed", source: file:///data/user/0/com.xxxx.android/files/kp_index.html?mockkp=true&storeall=true&loglevel=0&endpoint=aws (10)

@GengJian
Copy link
Author

GengJian commented Jul 5, 2022

  1. request

     mViewModel.createSessionIdLiveData.observe(this) {
         val returnUrl = "com.xxxx.android://klarna"
         val clientToken = it.sessionId
    
         if (clientToken.isNullOrBlank()) {
             vsShowShortToast("Error: no klarna client token")
         } else {
             GlobalScope.launch(Dispatchers.Main) {
                 mBinding.klarnaPaymentView.initialize(clientToken, returnUrl)
                 mBinding.klarnaPaymentView.category = KlarnaPaymentCategory.PAY_LATER
             }
         }
     }
    
  2. callback
    mBinding.klarnaPaymentView.category = KlarnaPaymentCategory.PAY_LATER
    mBinding.klarnaPaymentView.registerPaymentViewCallback(object : com.klarna.mobile.sdk.api.payments.KlarnaPaymentViewCallback {
    override fun onErrorOccurred(view: KlarnaPaymentView, error: KlarnaPaymentsSDKError) {
    Log.d(LOG_TAG, "Klarna onErrorOccurred...\n$error")
    }

         override fun onInitialized(view: KlarnaPaymentView) {
             Log.d(LOG_TAG, "Klarna onInitialized..\n$view...")
             view.load(null)
         }
    
         override fun onLoaded(view: KlarnaPaymentView) {
             // content has finished loading and if you have any progress bar you could hide it here
             Log.d(LOG_TAG, "Klarna onLoaded..\n$view...")
             view.authorize(true, null)
         }
    
         override fun onLoadPaymentReview(view: KlarnaPaymentView, showForm: Boolean) {
             Log.d(LOG_TAG, "Klarna onLoadPaymentReview..\n$showForm...")
         }
    

...
}

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