Klarna in flutter

748 Views Asked by At

I am trying to implement a Klarna payment solution in flutter for an app. The problem is that I don't know how to run Kotlin or Java code in flutter. Is it feasible or do I have to find another solution?

Kotlin code:

val paymentView: KlarnaPaymentView = findViewById(R.id.paymentView)
paymentView.category = KlarnaPaymentCategory.PAY_LATER 
paymentView.registerPaymentViewCallback(callback) 

Java code:

final KlarnaPaymentView paymentView = findViewById(R.id.paymentView);
paymentView.setCategory(KlarnaPaymentCategory.PAY_LATER);
paymentView.registerPaymentViewCallback(callback);

1

There are 1 best solutions below

0
On

What you are looking for are platform channels. Basically, you write native platform-specific methods and invoke them through a platform channel in your Dart code.

Learn how to do so here : Writing custom platform-specific code

EDIT : the package mollie seems to include the Klarna Sofort payment method. That may fit your needs.