I'm exploring the use of Stripe to process payments by app but am failing at the first code attempt. I'm hoping that if someone can provide a clue about the initial hurdle I'll be able to figure out the rest... ?
In trying to follow the Stripe setup instructions at https://stripe.com/docs/mobile/android/basic I'm using a JavaObject to access a de-sugared version of the Stripe JAR, using the tutorial example https://www.b4x.com/android/forum/t...h-additionaljar-and-javaobject-picasso.40904/
The problem is that B4A returns java.lang.ClassNotFoundException: com$stripe$android$PaymentConfiguration - so it doesn't seem to be able to find the Stripe JAR. Have I missed another initialization?
My "simple" test code is
In trying to follow the Stripe setup instructions at https://stripe.com/docs/mobile/android/basic I'm using a JavaObject to access a de-sugared version of the Stripe JAR, using the tutorial example https://www.b4x.com/android/forum/t...h-additionaljar-and-javaobject-picasso.40904/
The problem is that B4A returns java.lang.ClassNotFoundException: com$stripe$android$PaymentConfiguration - so it doesn't seem to be able to find the Stripe JAR. Have I missed another initialization?
My "simple" test code is
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
#AdditionalJar: stripe-java-18.5.0-converted
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout( "layout_main")
Init_stripeSDK
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Init_stripeSDK As JavaObject
Dim jo As JavaObject
'com.squareup.picasso.Picasso.with(context)
' Return jo.InitializeStatic("com.squareup.picasso.Picasso").RunMethod("with", Array(GetContext))
'com.stripe.android.PaymentConfiguration
'using own pk_test api key
Return jo.InitializeStatic( "com.stripe.android.PaymentConfiguration" ).RunMethod( "init", Array( GetContext, "pk_test_<my number>" ) )
End Sub
Sub GetContext As JavaObject
Return GetBA.GetField("context")
End Sub
Sub GetBA As JavaObject
Dim jo As JavaObject
Dim cls As String = Me
cls = cls.SubString("class ".Length)
jo.InitializeStatic(cls)
Return jo.GetFieldJO("processBA")
End Sub