package Ġcom . stripe . example . activity Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . View Ċ import Ġandroidx . lifecycle . Observer Ċ import Ġcom . stripe . android . model . Address Ċ import Ġcom . stripe . android . model . PaymentMethod Ċ import Ġcom . stripe . android . model . PaymentMethod Create Params Ċ import Ġcom . stripe . example . databinding . Kl arna Payment Activity Binding Ċ Ċ class ĠK l arna Payment Activity Ġ: ĠStripe Intent Activity () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġview Binding : ĠK l arna Payment Activity Binding Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ ĠK l arna Payment Activity Binding . inflate ( layout Inflater ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ ĠsetContentView ( view Binding . root ) ĊĊĠĠĠĠĠĠĠ ĠviewModel . in Progress . observe ( this , Ġ{ Ġenable Ui (! it ) Ġ}) ĊĠĠĠĠĠĠĠ ĠviewModel . status . observe ( this , ĠObserver ( view Binding . status :: setText )) ĊĊĠĠĠĠĠĠĠ Ġview Binding . confirm With Kl arna Button . setOnClickListener Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcreate And Confirm Payment Intent (" US ", Ġconfirm Params , Ġ" kl arna ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġenable Ui ( enable : ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġview Binding . progress Bar . visibility Ġ= Ġif Ġ( enable ) ĠView . IN VISIBLE Ġelse ĠView . VISIBLE ĊĠĠĠĠĠĠĠ Ġview Binding . confirm With Kl arna Button . isEnabled Ġ= Ġenable ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġconfirm Params Ġ= ĠPayment Method Create Params . create Kl arna ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbilling Details Ġ= ĠPayment Method . Billing Details ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġemail Ġ= Ġ" jen ny @ example . com ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġaddress Ġ= ĠAddress . Builder () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Country (" US ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} Ċ } Ċ